更新时间:2022-12-11 23:38:19
将sht设置为具有要复制的数据的工作表
将trg设置为目标工作表
将colCount设置为要复制的列数
set sht to the worksheet that has the data you want to copy
set trg to the target worksheet
set colCount to the number of columns to copy
Set rng = sht.Range(sht.Cells(5, 1), sht.Cells(65536, 1).End(xlUp).Resize(, colCount))
' start at row 5, then get the last row with data, and then expand to the number of columns
trg.Cells(65536, 1).End(xlUp).Offset(1).Resize(rng.Rows.Count, rng.Columns.Count).Value = rng.Value
' find last unused cell in first column, and copy the data there
(在excel 2007或更高版本中使用1048576而不是65536)
(use 1048576 instead of 65536 in excel 2007 or later)