View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
StephanieH StephanieH is offline
external usenet poster
 
Posts: 95
Default Define Range based on cell color

Thanks Tom.
It does hide the columns, but then appears to keep searching for additional
cells? I get the hour glass and it doesn't really stop searching. When I
hit Esc and Debug, the END IF statement is highlighted.

"Tom Ogilvy" wrote:

Sub tester1()
Columns.Hidden = False
For Each cell In ActiveSheet.UsedRange
If cell.Interior.ColorIndex = 37 Or cell.Interior.ColorIndex = 34 Then
cell.EntireColumn.Hidden = True
End If
Next
End Sub

--
Regards,
Tom Ogilvy




"StephanieH" wrote in message
...
Is it possible to define a range based on cell color? What I'd like to do

is
hide/unhide all columns containing cells with the background colors 34 and
37. After reading Dave Pearson's information, it seems possible but I

have
no idea how to make it work.