PC Review


Reply
Thread Tools Rate Thread

How can you flag a cell with fill colour

 
 
birdnat
Guest
Posts: n/a
 
      14th May 2009
I am trying to write a formula that tells me if a cell is not white and
return a flag.
 
Reply With Quote
 
 
 
 
Patrick Molloy
Guest
Posts: n/a
 
      14th May 2009
depends somewhat too on how you mean to 'flag' them....in this code i add a
new worksheet....

Option Explicit
Sub FlagColoredCells()
Dim ws As Worksheet 'for results
Dim cell As Range ' for find
Dim rowindex ' for results

For Each cell In ActiveSheet.UsedRange
If cell.Interior.ColorIndex <> xlNone Then
If ws Is Nothing Then
Set ws = Worksheets.Add
rowindex = 1
End If
ws.Cells(rowindex, 1) = cell.Address
ws.Cells(rowindex, 2) = cell.Interior.ColorIndex
rowindex = rowindex + 1
End If
Next
End Sub


"birdnat" <(E-Mail Removed)> wrote in message
news:65AC7691-FB47-4B21-9124-(E-Mail Removed)...
> I am trying to write a formula that tells me if a cell is not white and
> return a flag.


 
Reply With Quote
 
joel
Guest
Posts: n/a
 
      14th May 2009
you can use a worksheet function CELL
=cell("color",A1)

returns 1 if the cell is formatted in color for negative values; otherwise
returns 0 (zero).

This function and Patrick's solution will not work if the cell is colored
using conditional formating.

"Patrick Molloy" wrote:

> depends somewhat too on how you mean to 'flag' them....in this code i add a
> new worksheet....
>
> Option Explicit
> Sub FlagColoredCells()
> Dim ws As Worksheet 'for results
> Dim cell As Range ' for find
> Dim rowindex ' for results
>
> For Each cell In ActiveSheet.UsedRange
> If cell.Interior.ColorIndex <> xlNone Then
> If ws Is Nothing Then
> Set ws = Worksheets.Add
> rowindex = 1
> End If
> ws.Cells(rowindex, 1) = cell.Address
> ws.Cells(rowindex, 2) = cell.Interior.ColorIndex
> rowindex = rowindex + 1
> End If
> Next
> End Sub
>
>
> "birdnat" <(E-Mail Removed)> wrote in message
> news:65AC7691-FB47-4B21-9124-(E-Mail Removed)...
> > I am trying to write a formula that tells me if a cell is not white and
> > return a flag.

>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Fill cell colour based on input in another cell Dan Wood Microsoft Excel Worksheet Functions 2 20th Aug 2009 06:28 AM
fill cell with colour if preceding cell is a negative value POP Microsoft Excel Misc 4 27th Apr 2009 05:35 PM
cell colour fill ko Microsoft Excel Misc 5 13th Aug 2008 07:38 AM
Setting cell fill colour Jacetech Microsoft Excel Programming 2 16th Mar 2008 03:46 PM
How to make a cell copy the fill colour of another cell Chase Microsoft Excel Worksheet Functions 1 21st Feb 2008 10:29 AM


Features
 

Advertising
 

Newsgroups
 


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