jeffmfrank
Board Regular
- Joined
- Feb 28, 2002
- Messages
- 72
I found some good code to hide rows if a value is present in Column E of that row (which either contains "Hide" or "0"), but it's a loop and for 4200 rows it takes 10 minutes to work through. Any suggestions on how to speed this up?
I thought instead of evaluating each row and hiding, could I unhide all, evaluate each and select only, then hide all that had been selected? Anyone think this would be faster? What would that code look like? Thanks. Here's what I'm using now:
Private Sub Worksheet_Activate()
ActiveSheet.Protect DrawingObjects:=False, Contents:=False, Scenarios:=False
For Each c In Range("E1", Range("E4202").End(xlUp).Address)
Select Case c.Value
Case Is = "HIDE"
c.EntireRow.Hidden = True
Case Is = "0"
c.EntireRow.Hidden = False
End Select
Next c
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End Sub
Thanks!
I thought instead of evaluating each row and hiding, could I unhide all, evaluate each and select only, then hide all that had been selected? Anyone think this would be faster? What would that code look like? Thanks. Here's what I'm using now:
Private Sub Worksheet_Activate()
ActiveSheet.Protect DrawingObjects:=False, Contents:=False, Scenarios:=False
For Each c In Range("E1", Range("E4202").End(xlUp).Address)
Select Case c.Value
Case Is = "HIDE"
c.EntireRow.Hidden = True
Case Is = "0"
c.EntireRow.Hidden = False
End Select
Next c
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
End Sub
Thanks!