I'm pretty new to VBA and I'm having trouble writing a macro that copies a specified row from all sheets in a workbook into a single, specified worksheet. I've tried looking at other examples of people with the same problem but I can't seem to get my code to work. Here's what I have:
Sub copyrow()
Dim Nrow As Long
Dim Nsheet As Long
Dim ms As Worksheet
Dim i As Long
Set ms = Sheets("All Copper Data")
Nrow = 3
Nsheet = Worksheets.Count
For i = 1 To Nsheet
Sheets(i).Cells(Nrow, 1).EntireRow.Copy Destination:=Sheets("ms").Cells(i, 1)
Next i
End Sub
I have a bunch of sheets (at the moment, there are 14 sheets I want to collect data from, but there will be more which is why I have Nsheets as worksheets.count). I want to take row 3 from all of the sheets and consolidate them onto a sheet named "All Copper Data"
I'm getting subscript out of range errors. How do I go about fixing this?