This code is running in a userform. The logic I'm trying to code is:
If Activecell's value is not in the listbox then hide the entire row.
Here is my code thus far:
For Each Ctrl In Me.MultiPagePA.Pages(PgName).Controls '<--- Find the listbox control in this page If TypeOf Ctrl Is MSForms.ListBox Then For k = 1 To BlnRng '<--- Loop through each cell in the worksheet column (activecell's column) For j = 0 To Ctrl.ListCount - 1 '<--- Loop through each list value ActiveCell.EntireRow.Hidden = True If ActiveCell.Value = Ctrl.List(j) Then ActiveCell.EntireRow.Hidden = False '<--- *** If the activecell's value is in the list unhide the row (I cant get this statement to be true) *** MsgBox (Ctrl.List(j) & " & " & ActiveCell.Value) Next j ActiveCell.Offset(1, 0).Select '<--- move down to the next value Next k '<--- re-evaluate new activecell End If Next Ctrl
The code appears to be doing what I need it to do overall BUT I cant get the active cell value to equal the list value (at the *** comment section in the code above).
Even when the message box statement shows me that both variables are the same, the code at the *** comment wont move to my "then" statement.
I don't get any errors at runtime.
Anyone have any ideas what I'm doing wrong here?