I'm getting an error on a vba code I'm trying to write.
For i = 1 To 8
Range(Cells(2, i + 1), Cells(lastrow1, i + 1)).Select
Selection.Copy
Workbooks("Querypartlist.xlsx").Activate
Range(Cells(1 + lastrow1 * (i - 1), 1)).Select (THIS IS SPECIFICALLY HIGHLIGHTED LINE)
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Workbooks("Parts.xlsx").Activate
Next
The bolded line is the one I am having errors with. I can't figure out what the issue is. Up on the first line it can find a very similar range, the only difference is I've added the lastrow1(which is a long number). Anybody know what mistake I'm making?
For i = 1 To 8
Range(Cells(2, i + 1), Cells(lastrow1, i + 1)).Select
Selection.Copy
Workbooks("Querypartlist.xlsx").Activate
Range(Cells(1 + lastrow1 * (i - 1), 1)).Select (THIS IS SPECIFICALLY HIGHLIGHTED LINE)
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Workbooks("Parts.xlsx").Activate
Next
The bolded line is the one I am having errors with. I can't figure out what the issue is. Up on the first line it can find a very similar range, the only difference is I've added the lastrow1(which is a long number). Anybody know what mistake I'm making?
Last edited by a moderator: