Populate multicolumn userform listbox with data only from hidden rows

Intronaut

New Member
Joined
Oct 11, 2017
Messages
7
I've adopted the following code from various sources. Column A's data is populating the listbox fine, with each entry populating its respective listindex, but Column B's data (which I'm trying to capture with the .list) is only acting on the first listindex. What do I change?

Code:
Private Sub UserForm_Initialize()Dim rng As Range
Dim LastRow As Long
Dim I As Long
Dim x As Integer
ListBox1.Clear
    LastRow = ActiveSheet.Range("A100000").End(xlUp).Row
    For I = 1 To LastRow
        Set rng = ActiveSheet.Range("A" & I)
        If rng.EntireRow.Hidden = True Then
            With ListBox1
                .AddItem rng.Value
                .List(0, 1) = Range("B" & I).Value
            End With
        End If
    Next I
End Sub

Hope my question is clear, and many thanks for any insights you can offer...
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

Forum statistics

Threads
1,215,425
Messages
6,124,825
Members
449,190
Latest member
rscraig11

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top