VBA 将组合框值输出到列中的下一个空闲单元格
VBA output ComboBox value into the next free cell in Column
我正在尝试将用户窗体文本框中的值输出到列中的下一个空单元格中:
Private Sub CommandButton2_Click()
Dim LastRow As Long
With ThisWorkbook.Sheets("Output")
LastRow = .Cells(.Rows.Count, "H").End(xlUp).Row
With .Range("H" & LastRow)
.Value2 = TextBox1.Value
End With
End With
End Sub
但是,它不起作用,我没有收到任何错误消息。
你知道我哪里出错了吗?
谢谢
试试这个 *更改为 CommandButton2
Private Sub CommandButton2_Click()
Dim LastRow As Long
With ThisWorkbook.Sheets("Output")
LastRow = Cells(.Rows.Count, "H").End(xlUp).Offset(1, 0).Row
Range("H" & LastRow).Value = TextBox1.Value
End With
End Sub
我正在尝试将用户窗体文本框中的值输出到列中的下一个空单元格中:
Private Sub CommandButton2_Click()
Dim LastRow As Long
With ThisWorkbook.Sheets("Output")
LastRow = .Cells(.Rows.Count, "H").End(xlUp).Row
With .Range("H" & LastRow)
.Value2 = TextBox1.Value
End With
End With
End Sub
但是,它不起作用,我没有收到任何错误消息。
你知道我哪里出错了吗?
谢谢
试试这个 *更改为 CommandButton2
Private Sub CommandButton2_Click()
Dim LastRow As Long
With ThisWorkbook.Sheets("Output")
LastRow = Cells(.Rows.Count, "H").End(xlUp).Offset(1, 0).Row
Range("H" & LastRow).Value = TextBox1.Value
End With
End Sub