VBA将ComboBox值输出到列中的下一个空闲单元格中
我正在尝试从一个UserForm文本框输出到列中的下一个空单元格中的值:
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