Hi everyone,
I have a for loop macro to go through a list of sheet names but it keeps quitting out. i'm hoping someone can help me and let me know what is wrong with my code
My for loop is going through each sheet and the sheetlist is in Summary starting at A15. it seems to work for the first sheet in the list but then on the second sheet it gives me a subscript out of range error
code below
dim i as long
For i = 16 To Sheets("Summary").Cells(Rows.Count, 1).End(xlUp).Row + 1
With Sheets(i - 1)
sname = Worksheets("Summary").Range("A" & i - 1).Value
Sheets(sname).Select
Range("M20:M" & lastrow).Select
Selection.Copy
End With
Next i
can someone tell me where i went wrong with the code
thanks for everyone help.
Bookmarks