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
End Sub
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