假设 A 列最后一个单元格所在的行数小于 B 列最后一个单元格所在的行数。那么:
Option Explicit
Private Sub CommandButton1_Click()
Dim A_LastRow As Long, B_LastRow As Long
Application.EnableEvents = False
Application.ScreenUpdating = False
With Sheet1 '假设在工作表 Sheet1 中进行操作。运行代码前一定要修改
A_LastRow = .Cells(.Rows.Count, 1).End(xlUp)
B_LastRow = .Cells(.Rows.Count, 2).End(xlUp)
If A_LastRow < B_LastRow Then '楼主没有详细说明,那就假设在 A 列向下复制
.Cells(A_LastRow, 1).Copy .Range(.Cells(A_LastRow + 1, 1), .Cells(B_LastRow, 1))
Application.CutCopyMode = False
End If
End With
Application.ScreenUpdating = True
Application.EnableEvents = True
End Sub
温馨提示:答案为网友推荐,仅供参考