Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Color of cell.
Hello,
how can I identify which "fill color" is used on cell. For example: whatColor = range("A1") If whatColor = 1 then .... thanks Tom |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Color of cell.
If Range("A1").Interior.ColorIndex = 1 then
Mangesh "Tom" wrote in message ... Hello, how can I identify which "fill color" is used on cell. For example: whatColor = range("A1") If whatColor = 1 then .... thanks Tom |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Color of cell.
Hi Tom,
Sub Tester() Dim rng As Range Dim iColor As Long Set rng = Range("A1") iColor = rng.Interior.ColorIndex If iColor = 6 Then 'do something Else 'do something else End If End Sub --- Regards, Norman "Tom" wrote in message ... Hello, how can I identify which "fill color" is used on cell. For example: whatColor = range("A1") If whatColor = 1 then .... thanks Tom |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Color of cell.
if you use the .Color property, then you avoid possible issues where
different users have changed their color palette - to a degree. Also, using SELECT CASE can make your code a little more flexible... Option Explicit Enum eColors Red = 3 Blue = 5 Green = 4 Brown = 9 End Enum Sub Test() Select Case Selection.Interior.ColorIndex Case eColors.Blue 'process blue cell Case eColors.Brown 'process brown cell ' etc etc Case Else ' color not recognised End Select End Sub Sub ShowColors() Dim index As Long Range("A1:B57").Clear For index = 0 To 56 Cells(index + 1, 1) = index Cells(index + 1, 2).Interior.ColorIndex = index Next End Sub "Mangesh Yadav" wrote: If Range("A1").Interior.ColorIndex = 1 then Mangesh "Tom" wrote in message ... Hello, how can I identify which "fill color" is used on cell. For example: whatColor = range("A1") If whatColor = 1 then .... thanks Tom |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Can't format cell color/text color in Office Excel 2003 in fil | Excel Discussion (Misc queries) | |||
Excel: Syntax to change cell color based on color of another cell | Excel Worksheet Functions | |||
Can't format cell color/text color in Office Excel 2003 in files . | Excel Discussion (Misc queries) | |||
Default Border, Font Color, and Cell Background Color | Excel Discussion (Misc queries) | |||
Browse Forms Controls and change TextBox color based on cell color | Excel Programming |