Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Here is a piece of code I'm using to hide rows that have an "x" in two of the
columns. Is there a more efficient way to write this. thanks Sub HideRows() Application.ScreenUpdating = False Dim rng As Range Dim i As Long Set rng = Range("E5:E204") i = 0 'set up a variable to see if range contains hidden rows For Each c In rng If c.EntireRow.Hidden = True Then c.EntireRow.Hidden = False i = 1 End If Next If i = 1 Then 'if any hidden rows unhide Application.ScreenUpdating = True Exit Sub End If For Each c In rng 'if no hidden rows unhidden then hide If c.Value = "x" And c.Offset(0, 3).Value = "x" Then c.EntireRow.Hidden = True End If Next Application.ScreenUpdating = True End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
making code more efficient | Excel Discussion (Misc queries) | |||
Which is more efficient? | Excel Programming | |||
Making code more efficient | Excel Programming | |||
Book on how to write VBA code in a fast/efficient manner? | Excel Programming | |||
More efficient code | Excel Programming |