Good morning everyone,
I have a macro that I want to sort data. A button in my workbook calls a small userform with 10 checkboxes. The user should pick those categories that he wants to review and click sort. The result I want is for only the categories he chose to be displayed but I am getting an all or nothing result out of the attached macro. Below is that macro that supports the form/button to sort the categories. I feel like the answer is right under my nose but I am just not seeing it! Any help you could offer would be greatly appreciated.
Thanks!
![]()
Private Sub cmdSort_Click() LastRow = Range("A" & Rows.Count).End(xlUp).Row If chkFE = True Then For Each cell In Range("BC4:BC" & LastRow) If UCase(cell.Value) <> "Fire Extinguishers" Then cell.EntireRow.Hidden = True End If Next End If If chkChem = True Then For Each cell In Range("BD4:BD" & LastRow) If UCase(cell.Value) <> "Chem" Then cell.EntireRow.Hidden = True End If Next End If If chkFL = True Then For Each cell In Range("BE4:BE" & LastRow) If UCase(cell.Value) <> "FL" Then cell.EntireRow.Hidden = True End If Next End If If chkElec = True Then For Each cell In Range("BF4:BF" & LastRow) If UCase(cell.Value) <> "Elec" Then cell.EntireRow.Hidden = True End If Next End If If chkFP = True Then For Each cell In Range("BG4:BG" & LastRow) If UCase(cell.Value) <> "FP" Then cell.EntireRow.Hidden = True End If Next End If If chkLift = True Then For Each cell In Range("BH4:BH" & LastRow) If UCase(cell.Value) <> "Lift" Then cell.EntireRow.Hidden = True End If Next End If If chkPPE = True Then For Each cell In Range("BI4:BI" & LastRow) If UCase(cell.Value) <> "PPE" Then cell.EntireRow.Hidden = True End If Next End If If chkPS = True Then For Each cell In Range("BJ4:BJ" & LastRow) If UCase(cell.Value) <> "PS" Then cell.EntireRow.Hidden = True End If Next End If If chkSTF = True Then For Each cell In Range("BK4:BK" & LastRow) If UCase(cell.Value) <> "STF" Then cell.EntireRow.Hidden = True End If Next End If If chkErgonomics = True Then For Each cell In Range("BL4:BL" & LastRow) If UCase(cell.Value) <> "Ergonomics" Then cell.EntireRow.Hidden = True End If Next End If Unload frmSort End Sub
Bookmarks