View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 1,726
Default Hiding row base on cell content

See if this is any quicker. It utilises an approach proposed by Dave
Peterson


Sub HideGrey()
Dim cell As Range
Dim rngIsect As Range
Dim rngColoured As Range

Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual

Set rngIsect = Application.Intersect(ActiveSheet. _
UsedRange, Range("A:A"))

Columns(2).Insert
For Each cell In rngIsect
If cell.Interior.ColorIndex = 15 Then 'Gray-25%
cell.Offset(0, 1).Value = 1
End If
Next
Rows(1).Insert
Range("B1").Value = "Temp"

Set rngColoured = Range("B1").Resize(Cells(Rows.Count,
"B").End(xlUp).Row)
rngColoured.AutoFilter field:=1, Criteria1:="1"
Set rngColoured = rngColoured.SpecialCells(xlCellTypeVisible)
rngColoured.AutoFilter
rngColoured.EntireRow.Hidden = True
Rows(1).Delete
'Columns(2).Delete

Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic

End Sub

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"brownti via OfficeKB.com" <u31540@uwe wrote in message
news:6dcc96641ea30@uwe...
Nope, still takes forever. all the other macros that occur on that page
dont
take nearly as long. could it just be the size of the sheet? 4000 rows?


Bob Phillips wrote:
Maybe turn off automatic calculation

Application.Calculation = xlCalculationManual

at the start, and back on at the end

Application.Calculation = xlCalculationAutomatic

I guess it does stop, but it takes years to perform. i changed it to not
screen update and it still takes forever. Any ideas to speed it up?

[quoted text clipped - 9 lines]
will
have another button that will unhide all those rows. Thanks,


--
Message posted via http://www.officekb.com