Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am kind of with you on this one Bob. It is not 100% evident what is going
on but doing a find and find next should be a little quicker (not much in this case) shouldn't it? if anyone would know... you would... "Bob Phillips" wrote: I am a bit confused by what is going on here. You unhide hidden rows, but exit if there were any, then you hide rows with x x in? Is that right? -- HTH Bob Phillips "thom hoyle" wrote in message ... 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 |