I'm trying to hide rows without using autofilter (I need to execute
code when filter choice is changed and don't want to have to use
Worksheet_Calculate because of all the complications it can cause), so
I"m using a dropdown from the forms toolbar. My problem is the
execution is slow. Is there a faster way to do this? Here's my code:
Public Sub DropDownBU_Change(Optional bPrinting As Boolean)
Dim strBUChoice As String, r As Range, rngEmployees As Range
Application.ScreenUpdating = False
Cells.Rows.Hidden = False
strBUChoice = Range("CurrentFilterSetting").Text
Set rngEmployees = Range("EmployeeTable")
For Each r In rngEmployees.Rows
If Intersect(r, Range("BUColumn")).Value <> strBUChoice Then
r.Hidden = True
Next r
Application.ScreenUpdating = True
End Sub
Bookmarks