【问题标题】:Removing empty rows of combobox in excel - VBA删除excel中组合框的空行 - VBA
【发布时间】:2018-10-08 03:50:29
【问题描述】:

此代码显示 Sheet1 的所有单元格列 A即使是空值)。 最后一行combobox1中有的解决方法是什么> (并在末尾删除 empaty 值)?

Private Sub UserForm_Initialize()
ComboBox1.List = Sheets("Sheet1").Range("A:A").Value
End Sub

【问题讨论】:

    标签: excel vba combobox userform


    【解决方案1】:

    试试这个:

    With Sheets("Sheet1")
        ComboBox1.List = .Range(.Range("A1"), .Cells(.Rows.count, 1).End(xlUp)).Value
    End With
    

    【讨论】:

    • 您好,谢谢。你留下了“结束于”这个词
    【解决方案2】:
    Private Sub UserForm_Initialize()
    With Sheets("Sheet1")
      ComboBox1.List = .Range(.Range("A1"), .Cells(.Rows.Count,1).End(xlUp)).Value
    End With
    End Sub
    

    【讨论】:

      猜你喜欢
      • 2012-03-11
      • 2015-04-13
      • 1970-01-01
      • 2020-03-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-18
      • 1970-01-01
      相关资源
      最近更新 更多