Private Sub CommandButton1_Click() Dim lRow As Long Dim ws As Worksheet Set ws = Worksheets(\'Sheet2\') lRow = ws.Cells(Rows.Count, 1).End(x1Up).Offset(1, 0).Row With ws.Cells(lRow, 1).Value =
Private Sub CommandButton1_Click()
Dim lRow As Long
Dim ws As Worksheet
Set ws = Worksheets("Sheet2")
lRow = ws.Cells(Rows.Count, 1).End(x1Up).Offset(1, 0).Row
With ws
.Cells(lRow, 1).Value = UserForm1.TextBox1.Value
.Cells(lRow, 2).Value = UserForm1.TextBox2.Value
End With
End Sub
我正在使用此宏将一些条目添加到单元格中。我只想将 2 个值添加到文本框中,然后按下按钮将条目移动到 Sheet2 中。第二次,这 2 个条目将移动到第一个条目下方,依此类推...
每次我按下按钮时都会收到消息“运行时错误 1004”。