I am attempting to filter my listview upon populating based on an employee number. I can see the value is being retained, it's an employee number, but the system doesn't return anything.
VBA Code:
Sub UserForm_Activate()
Dim p As Long
Dim CLN As Integer
Dim ws As Worksheet
Set ws = ThisWorkbook.Worksheets("EventLog")
Dim x As Integer
Dim RNG As Variant
Dim C As Integer
EmpNum = EventLog.EmpNum.Value
With Me.EventHistoryLV
.ListItems.Clear
.ColumnHeaders.Clear
.FullRowSelect = True
.ColumnHeaders.Add , , "Event ID", 20
.ColumnHeaders.Add , , "EmpNum", 50
.ColumnHeaders.Add , , "LastName", 80
.ColumnHeaders.Add , , "FirstName", 80
.ColumnHeaders.Add , , "Details", 250
.ColumnHeaders.Add , , "Update Time", 120
For p = 1 To ws.Range("A1000000").End(xlUp).Row
If ws.Range("B" & p).Value = EmpNum Then
.ListItems.Add , , ws.Cells(p + 1, "A")
CLN = CLN + 1
.ListItems(CLN).ListSubItems.Add , , ws.Cells(p + 1, "B") '1
.ListItems(CLN).ListSubItems.Add , , ws.Cells(p + 1, "C") '2
.ListItems(CLN).ListSubItems.Add , , ws.Cells(p + 1, "D") '3
.ListItems(CLN).ListSubItems.Add , , ws.Cells(p + 1, "E") '4
.ListItems(CLN).ListSubItems.Add , , ws.Cells(p + 1, "F") '5
End If
Next p
End With
End Sub