VBA - Copy variable range from one sheet to another
问题 I would like to copy data from a sheet "Inv_Headers", Column C, from 2nd row until the last row to a sheet "Customers", Column U, from 4th row. Private Sub Invoice_C() Dim ws As Worksheet, ws1 As Worksheet Dim lastrow As Long Set ws = Worksheets("Inv_Headers") Set ws2 = Worksheets("CUSTOMERS") lastrow = ws.Cells(Rows.Count, 3).End(xlUp).Row ' last row in column C ws.Range("C2:C" & lastrow).Copy ws1.Range("U4").PasteSpecial xlPasteValues ws1.Activate End Sub My code is giving me error msg '91'