消除listbox rowsource中的空白单元格

我正在尝试制作一个消除行上空白单元格的列表框。 在列A我有一些包含数据和一些是空白的单元格。 我无法删除空行,因为在其他列中包含数据。 我怎样才能在listbox的非空白单元格的行rowsource

如何检查每个单元格中是否有值的循环:

 Dim CountLng as Long 'Set CountLng to maximum row in column A that you would like to search for. 'This example uses the number of rows in the entire used range of the worksheet CountLng = ActiveSheet.UsedRange.Rows.Count With listbox1 ' Loop over each cell in the column A For x = 1 To CountLng ' If the cell is not blank then add it as a list item If ActiveSheet.Range("A" & x).Value <> "" Then .AddItem ActiveSheet.Range("A" & x).Value End If Next x End With