LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Macro to select cells within a range in which the cell color is none

I said:
Interior.ColorIndex is not altered by conditional formatting.


I also gave you a reference to a web page that gives you the code to do what
you describe.

--
Regards,
Tom Ogilvy

"PCLIVE" wrote in message
...
Tom,

Your revised code does in fact select all the cells in the range. Not

just
the ones that I want. Apparently when a cell is shaded due to conditional
formatting, it is not the same as the cell.ColorIndex. So maybe there is
another way to do this. Would it be possible to have code that would
determine if FormatConditions(1) is true? Then this could become the
strSubSet or Union.

I appreciate the help.
Paul

"Tom Ogilvy" wrote in message
...
It is best to check the condition that governs the conditional

formatting.
Interior.ColorIndex is not altered by conditional formatting. Checking

it
is extremely complex and inefficient - thus the advice to check the
condition itself.

However, the problem with error produced by the original code is

checking
for zero instead of checking for xlNone would be my guess.

My revised code should select all your cells.

If you really want to check for the color produced by conditional
formatting, look at Chip Pearson's page on this:

http://www.cpearson.com/excel/CFColors.htm

--
Regards,
Tom Ogilvy



"PCLIVE" wrote in message
...
I forgot to include this.

The cells that are being colored, are done so through conditional
formatting. I think that may be part of my problem. Is there a way to
apply your code to cells that have Conditional Formatting applied to
them?

Thanks again,
Paul

"PCLIVE" wrote in message
...
Thanks for the response

I tried this and I get a "Run-time error '5': Invalid procedure call
or
argument" at:
strSubSet = Left(strSubSet, Len(strSubSet) - 1)

I pasted the code exactly with no other code involved. Am I missing
something?

Thanks,
Paul



"Executor" wrote in message
oups.com...
Hi Paul,

Try this:

Sub SelectWithBlancInterior()
Dim rngLoop As Range
Dim strSubSet As String
'
For Each rngLoop In Range("A2", "A27")
If rngLoop.Interior.ColorIndex = 0 Then
strSubSet = strSubSet & rngLoop.Address & ","
End If
Next
strSubSet = Left(strSubSet, Len(strSubSet) - 1)

Range(strSubSet).Select

End Sub


Hoop that helps,

Wouter











 
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
Select range of cells from A1 to last cell with data? Bob Arnett Excel Discussion (Misc queries) 8 September 25th 09 04:31 PM
how can I select a range of cells based on a value of a cell? grigoras victor Excel Discussion (Misc queries) 1 June 26th 06 04:55 PM
Macro €“ select all cells in current range Mary Ann Excel Discussion (Misc queries) 3 December 12th 05 07:19 AM
if a cell is 0, how do I select a range of cells? Angela0212 Excel Programming 3 July 24th 04 12:44 AM
using cell values to select range of cells Ray[_9_] Excel Programming 4 October 10th 03 08:31 AM


All times are GMT +1. The time now is 12:26 PM.

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"