AndresHernando
asked on
Hide rows that contain a specific value
My code is too slow. Is there a faster way to hide rows for a range based on the value of the cells?
I want to hide all the rows in myRange when the cell value = 1
This is what I have now:
For Each cCell In Range("myRange")
If cCell.Value = 1 Then
cCell.EntireRow.Hidden = True
Else
cCell.EntireRow.Hidden = False
End If
Next cCell
I want to hide all the rows in myRange when the cell value = 1
This is what I have now:
For Each cCell In Range("myRange")
If cCell.Value = 1 Then
cCell.EntireRow.Hidden = True
Else
cCell.EntireRow.Hidden = False
End If
Next cCell
ASKER
Martin, thanks for the suggestion but the problem is the looping. I developed a work-around by using xlSpecialCells.
Thanks, --Andres
Thanks, --Andres
ASKER
I named a range next to the one in question in which I put in blanks for the rows to hide then ran the code:
Range("myRangeWithBlanks") .SpecialCe lls(xlCell TypeBlanks ).EntireRo w.Hidden = True
Now there's no looping and the procedure hides the rows in an instant.
Range("myRangeWithBlanks")
Now there's no looping and the procedure hides the rows in an instant.
ASKER
I've requested that this question be closed as follows:
Accepted answer: 0 points for AndresHernando's comment #a38448940
for the following reason:
Expert solution still looped which made it too slow. My solution overcame this and is very fast.
Accepted answer: 0 points for AndresHernando's comment #a38448940
for the following reason:
Expert solution still looped which made it too slow. My solution overcame this and is very fast.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window