Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default Filter on Color

I have code that highlights cells in certain records based on my
rules. I have code that removes these highlights.

Works just great.

Now I would like to be able to create a filter that will JUST show the
rows where one or more cells are highlighted. I am currently using
only 3 colors, Light Yellow, Lavender and Pink for the highlighted
cells.

I haven't found any clever way to display just the rows WITH
highlighted cells.

Any ideas,
Dennis

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Filter on Color

This macro will examine each row in ActiveSheet.Usedrange (extended) and hide
rows which are totally colorless.:

Sub color_shower()
Dim b As Boolean

Set r = ActiveSheet.UsedRange
nLastRow = r.Rows.Count + r.Row - 1

For rr = 1 To nLastRow
b = True
For cl = 1 To Columns.Count
If Cells(rr, cl).Interior.ColorIndex < xlNone Then
b = False
End If
Next
If b Then
Cells(rr, 1).EntireRow.Hidden = True
End If
Next
End Sub

--
Gary''s Student - gsnu200743


"ssGuru" wrote:

I have code that highlights cells in certain records based on my
rules. I have code that removes these highlights.

Works just great.

Now I would like to be able to create a filter that will JUST show the
rows where one or more cells are highlighted. I am currently using
only 3 colors, Light Yellow, Lavender and Pink for the highlighted
cells.

I haven't found any clever way to display just the rows WITH
highlighted cells.

Any ideas,
Dennis


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default Filter on Color

On Sep 6, 4:56 pm, Gary''s Student
wrote:
This macro will examine each row in ActiveSheet.Usedrange (extended) and hide
rows which are totally colorless.:

Sub color_shower()
Dim b As Boolean

Set r = ActiveSheet.UsedRange
nLastRow = r.Rows.Count + r.Row - 1

For rr = 1 To nLastRow
b = True
For cl = 1 To Columns.Count
If Cells(rr, cl).Interior.ColorIndex < xlNone Then
b = False
End If
Next
If b Then
Cells(rr, 1).EntireRow.Hidden = True
End If
Next
End Sub

--
Gary''s Student - gsnu200743



"ssGuru" wrote:
I have code that highlights cells in certain records based on my
rules. I have code that removes these highlights.


Works just great.


Now I would like to be able to create a filter that will JUST show the
rows where one or more cells are highlighted. I am currently using
only 3 colors, Light Yellow, Lavender and Pink for the highlighted
cells.


I haven't found any clever way to display just the rows WITH
highlighted cells.


Any ideas,
Dennis- Hide quoted text -


- Show quoted text -


Thanks Gary's Student, the code looked good but all I got was the for
next loop running endlessly using F8. The nLastRow value shows the
correct count of 12 rows in the sample sheet. But one of the rows had
a cell with Light Yellow and the code should have filtered to display
only that one row???

Any suggestions?
Dennis

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Filter by Color Chin via OfficeKB.com Excel Worksheet Functions 0 June 22nd 09 01:46 AM
filter by color Namvar Excel Discussion (Misc queries) 1 January 20th 09 11:44 PM
Filter by color Pawan Excel Programming 5 October 25th 05 09:22 AM
Filter by Color carl Excel Worksheet Functions 1 July 14th 05 05:02 PM
Filter by color of row Brie Excel Worksheet Functions 1 February 1st 05 07:13 PM


All times are GMT +1. The time now is 07:29 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"