我需要一个代码来复制最后26个单元格的第10行数据。我没有成功尝试以下代码:
Sub GetLastCells()
Dim lc As Long
With ThisWorkbook.Worksheets("PROCV")
lc = .Cells(10, Columns.Count).End(xlToLeft).Column
With .Cells(10, lc - 26).Resize(lr, 27).Copy
End With
End With
End Sub
任何帮助都将不胜感激。
答案 0 :(得分:0)
更容易看到:
Sub GetLastCells()
Dim lc As Long
With ThisWorkbook.Worksheets("PROCV")
lc = .Cells(10, Columns.Count).End(xlToLeft).Column
kc = lc - 25
Range(Cells(10, kc), Cells(10, lc)).Copy
End With
End Sub