Need to add additional listbox

inkbird1

Board Regular
Joined
Apr 21, 2020
Messages
51
Hi guys I have the following code - I want to have a listbox2 on the userform to show "active" entries, where in the code do i add this line to show the Active entries

VBA Code:
       Private Sub UserForm_Initialize()
Dim arrData As Variant
Dim arrExpired As Variant
Dim lngRow As Long
Dim cnt As Long

arrData = Sheets("Data").Range("A1").CurrentRegion.Value

ReDim arrExpired(1 To 3, 1 To UBound(arrData, 1))

For lngRow = 2 To UBound(arrData, 1)

If arrData(lngRow, 7) = "Expired" Then
cnt = cnt + 1
arrExpired(1, cnt) = arrData(lngRow, 2)
arrExpired(2, cnt) = arrData(lngRow, 5)
arrExpired(3, cnt) = arrData(lngRow, 6)
End If

Next lngRow

ReDim Preserve arrExpired(1 To 3, 1 To cnt)

With ListBox1
.ColumnCount = 3
.Column = arrExpired
End With
End Sub
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.

Forum statistics

Threads
1,214,591
Messages
6,120,424
Members
448,961
Latest member
nzskater

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