Public Sub Test()
Dim SourceRange As Range
Set SourceRange = ThisWorkbook.Worksheets("SheetA").Range("Q3:X3000")
' - OR -
' With ThisWorkbook.Worksheets("SheetA")
' 'Looks in column X for last row:
' Set SourceRange = .Range(.Cells(3, 17), .Cells(.Rows.Count, 24).End(xlUp))
'
' ' - OR -
' 'Looks in column Q for last row:
' Set SourceRange = .Range(.Cells(3, 17), .Cells(.Cells(.Rows.Count, 17).End(xlUp).Row, 24))
' End With
'*************
'Cells(3, 17) = row 3, column 17 = Q3
'Cells(.Rows.Count,24) = row 1048576, column 24 = X1048576
'End(xlUp) = go up to first non-blank cell.
'*************
Dim TargetTable As ListObject
Set TargetTable = ThisWorkbook.Worksheets("SheetB").ListObjects("Table3")
SourceRange.Copy Destination:=TargetTable.DataBodyRange.Offset(TargetTable.DataBodyRange.Rows.Count).Resize(1, 1)
End Sub
1条答案
按热度按时间wh6knrhe1#