Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Selecting cells by color?

Is there a way to select cells based on color?
Do I need to do this with a program or does Excel have a
function to do this?


Sub FindSameCells()
ci = ActiveCell.Interior.ColorIndex
For Each c In ActiveSheet.UsedRange
If c.Interior.ColorIndex = ci Then
'Add this cell to the SelectionRange
end if
Next c
SelectionRange.Select
End Sub


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Selecting cells by color?

Sub FindSameCells()
Dim rng as Range, c as Range
Dim ci as Long
ci = ActiveCell.Interior.ColorIndex
For Each c In ActiveSheet.UsedRange
If c.Interior.ColorIndex = ci Then
if rng is nothing then
set rng = c
else
set rng = Union(c,rng)
end if
end if
Next c
rng.Select
End Sub

No built in support for this.

--
Regards,
Tom Ogilvy

"Gary Adamson" wrote in message
...
Is there a way to select cells based on color?
Do I need to do this with a program or does Excel have a
function to do this?


Sub FindSameCells()
ci = ActiveCell.Interior.ColorIndex
For Each c In ActiveSheet.UsedRange
If c.Interior.ColorIndex = ci Then
'Add this cell to the SelectionRange
end if
Next c
SelectionRange.Select
End Sub




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
Can you change the color used when selecting cells in Excel? John B.[_2_] Excel Discussion (Misc queries) 1 January 13th 09 10:16 PM
Can you change the color used when selecting cells in Excel? John B. Excel Discussion (Misc queries) 1 January 8th 09 12:46 AM
how to set shading color of selection when i am selecting cells? N.A. Kamka Setting up and Configuration of Excel 0 May 7th 08 05:14 AM
Selecting cells of a specific color only. David Excel Discussion (Misc queries) 9 February 14th 08 01:39 AM
Conditional to change cell color by Selecting Cells maperalia Excel Discussion (Misc queries) 4 June 24th 07 06:53 AM


All times are GMT +1. The time now is 12:15 AM.

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

About Us

"It's about Microsoft Excel"