#跟着文心一言学VBA
Sub CopyA1ToLastRow()
Dim lastRow As Long
'Rows.Count是指当前活动工作表的行数,为数字 1048576,是Excel工作表的最大行数
'End(xlUp)等同于End mode下+UP键,或Ctrl+Up
lastRow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row
'弹出的消息框中显示当前工作簿的最后一行
MsgBox "The last row in the workbook is: " & lastRow
'将第一行内容复制到最后一行
Rows("1:1").Copy Destination:=Rows("1:1").End(xlUp).Offset(lastRow, 0)
End Sub