【发布时间】:2016-11-19 16:56:12
【问题描述】:
我想将数据从特定单元格中的“Sheet1”复制到“Sheet2”中的下一个可用空单元格,这样更改 (F9) 会导致从 Sheet1 复制数据并在 Sheet2 中填充一列数据.
到目前为止,我有以下内容,这会引发错误:(.Rows.Count
每次按“F9”刷新工作簿时,是否可以在 Sheet2 中填充一列?
'In this example I am Copying the Data from Sheet1 (Source) to Sheet2 (Destination)
Private Sub worksheet_calculate()
'Method 2
'Copy the data
Sheets("Sheet1").Range("I1").Copy
'Activate the destination worksheet
Sheets("Sheet2").Activate
'Select the target range
Sheet2.Cells(.Rows.Count, "A").End(xlUp).Row
'Paste in the target destination
ActiveSheet.Paste
Application.CutCopyMode = False
End Sub
【问题讨论】:
-
试试我下面回答中的代码,让我知道它是否如您所愿