I want to filter a range (9 columns and 1400 rows) by values in a column (rng01)
Application.ScreenUpdating = False
db.Rows.Hidden = False
For Each cell In rng01.Cells
If Not cell.Value = "323" Then
cell.EntireRow.Hidden = True
End If
Next cell
Application.ScreenUpdating = True
This works, but takes about 3-4 seconds.
Is there a faster way, pls ?
Lets see if I understand your question:
rng01is one of the nine columns, you want to filter so that only rows where the value inrng01=323are visible.You can use
AutoFilterfor this. You will need a header row above your data (but it can be blank).If the sheet
rng01referes to already has an activeAutoFilter, the firstrng01.AutoFilterclears it.Note that
rng01is one column wide.If in fact
rng01referes to a range wider than one column, use