ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Simple Q about font color (https://www.excelbanter.com/excel-programming/308172-simple-q-about-font-color.html)

43N79W

Simple Q about font color
 
How do I retrieve a fonts color? Do I access the color index number or is
there a text value that is a property of the font color?

TIA.

-gk-


--
=================================================
The creative act is not the province of remote oracles or rarefied geniuses
but a transparent process that is open to everyone.
-Greg Kot in Wilco Learning How To Die-



DavidC[_2_]

Simple Q about font color
 
Each colour has it's own value.
eg this makes the selected cell(S) green. Yellow is 6 and
red is 3.
With Selection.Interior
.ColorIndex = 4
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With

BOL
DavidC
-----Original Message-----
How do I retrieve a fonts color? Do I access the color

index number or is
there a text value that is a property of the font color?

TIA.

-gk-


--
=============================================== ==
The creative act is not the province of remote oracles or

rarefied geniuses
but a transparent process that is open to everyone.
-Greg Kot in Wilco Learning How To Die-


.


38N90W

Simple Q about font color
 
I have no problem setting font properties. I need to access font properties
without changing them

For instance, cell A1 contains a text value. I want something like:

MsgBox Range("A1").Font.ColorIndex

-OR-

a = Selection.Font.ColorIndex


Of course, these don't work.

-gk-


"DavidC" wrote in message
...
Each colour has it's own value.
eg this makes the selected cell(S) green. Yellow is 6 and
red is 3.
With Selection.Interior
.ColorIndex = 4
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
End With

BOL
DavidC
-----Original Message-----
How do I retrieve a fonts color? Do I access the color

index number or is
there a text value that is a property of the font color?

TIA.

-gk-


--
=============================================== ==
The creative act is not the province of remote oracles or

rarefied geniuses
but a transparent process that is open to everyone.
-Greg Kot in Wilco Learning How To Die-


.




JE McGimpsey

Simple Q about font color
 
What "doesn't work" about your statements?

Either will return 1 of the 56 colorindex values, or
xlColorIndexAutomatic (-4105).

Note if the selection contains more than one cell with different font
colors, Selection.Font.ColorIndex returns Null.


In article ,
"38N90W" wrote:

I have no problem setting font properties. I need to access font properties
without changing them

For instance, cell A1 contains a text value. I want something like:

MsgBox Range("A1").Font.ColorIndex

-OR-

a = Selection.Font.ColorIndex


Of course, these don't work.


Jarek[_10_]

Simple Q about font color
 
Hi,
I think MsgBox Range("A1").Font.ColorIndex works. Try next procedure.

Sub test_colorindex()
For i = 0 To 56
With Range("A1").Offset(i)
.Value = i
.Font.ColorIndex = i
.Offset(, 1).Value = .Font.ColorIndex
End With
Next i
End Sub

Jare

--
Message posted from http://www.ExcelForum.com


38N90W

Simple Q about font color
 

"JE McGimpsey" wrote in message
...
What "doesn't work" about your statements?

Either will return 1 of the 56 colorindex values, or
xlColorIndexAutomatic (-4105).

Note if the selection contains more than one cell with different font
colors, Selection.Font.ColorIndex returns Null.



A Ha!

My text in question had different colors, which I hadn't noticed (long story
but a good reason for that).

Seems my problem just a got a bit more complex. Thanks!

-gk-




All times are GMT +1. The time now is 10:01 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com