Sub 按钮1_Click() Dim lastCell As Range With ThisWorkbook With .Sheets("保存数据") Set lastCell = .Range("A1").Offset(.UsedRange.Rows.Count) End With .Sheets("数据录入").Range("A4:M24").Copy lastCell End With Application.CutCopyMode = False MsgBox "数据保存成功!" End Sub
Sub 按钮1_Click() Dim lastCell As Range With ThisWorkbook With .Sheets("保存数据") Set lastCell = .Range("A1").Offset(.UsedRange.Rows.Count) .Activate End With With .Sheets("数据录入").Range("A4:M24") .Value = "我是数据" .Copy lastCell End With lastCell.Select End With Application.CutCopyMode = False MsgBox "数据保存成功!" End Sub
Sub 按钮1_Click() Dim lastCell As Range With ThisWorkbook With .Sheets("保存数据") Set lastCell = .Range("A1").Offset(.UsedRange.Rows.Count - 1) End With .Sheets("数据录入").Range("A4:M24").Copy lastCell End With Application.CutCopyMode = False MsgBox "数据保存成功!" End Sub
Sub 按钮1_Click() Dim lastCell As Range With ThisWorkbook With .Sheets("保存数据") Set lastCell = .Range("A" & .Rows.Count).End(xlUp).Offset(1) End With .Sheets("数据录入").Range("A4:M24").Copy lastCell End With Application.CutCopyMode = False MsgBox "数据保存成功!" End Sub