Those 2 code do different things. The first will skip empty cells between row 1 and the end row. The second uses all cells between row 1 and end row.
2 columns
Dim rngName As Range
Dim ws As Worksheet
Dim i As Integer
Me.ListBox1.ColumnCount = 2
Me.ListBox1.ColumnWidths = "30;10"
Set ws = Worksheets("Data")
For i = 1 To ws.Cells(ws.Rows.Count, 1).End(xlUp).Row Step 1
If ws.Cells(i, 1).Value <> vbNullString Then
Me.ListBox1.AddItem ws.Cells(i, 1)
Me.ListBox1.List(Me.ListBox1.listcount-1,1)= ws.Cells(i, 2)
End if
Next i
With Sheets("Data")
ListBox1.ColumnCount = 2
ListBox1.ColumnWidths = "30;10"
ListBox1.List = .Range("A1:B" & .Range("A" & .Rows.Count).End(xlUp).Row).Value
End With
Bookmarks