添加按钮并分配此代码:
Sub CopyData()
'Define the source and destination worksheets
Dim wsSource As Worksheet
Dim wsDestination As Worksheet
Set wsSource = ThisWorkbook.Sheets("Sheet1")
Set wsDestination = ThisWorkbook.Sheets("Sheet2")
'Define the source and destination ranges
Dim rngSource As Range
Dim rngDestination As Range
Set rngSource = wsSource.Range("A1")
Set rngDestination = wsDestination.Range("A1")
'Copy the data from the source range to the destination range
rngDestination.CopyFromHere rngSource
'Find the next empty row in the destination worksheet
Dim lRow As Long
lRow = wsDestination.Cells(wsDestination.Rows.Count, 1).End(xlUp).Row + 1
'Select the next empty row
wsDestination.Rows(lRow).Select
End Sub