ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Differences concerning BackColor and ColorIndex (https://www.excelbanter.com/excel-programming/351503-differences-concerning-backcolor-colorindex.html)

Peres

Differences concerning BackColor and ColorIndex
 
I €˜d like to change a line color depending on the Backcolor of a OptionButton
but when I ask :
Color1 = OptionButton1.BackColor

The result do not match to:
Range("AF16").Interior.ColorIndex = Color1

Does sameone knows how can I make it works?

Tanks a lot
Peres

--
Peres

Tim Williams

Differences concerning BackColor and ColorIndex
 
Color is a long (RGB) value and ColorIndex is the index (position) of a
color in the workbook color table.

Try:

Range("AF16").Interior.Color = Color1

Note that if you try to set a cell interior color to one which is not in the
workbook color table then Excel will use the "closest" color from the table
instead.


Tim

--
Tim Williams
Palo Alto, CA


"Peres" wrote in message
...
I 'd like to change a line color depending on the Backcolor of a

OptionButton
but when I ask :
Color1 = OptionButton1.BackColor

The result do not match to:
Range("AF16").Interior.ColorIndex = Color1

Does sameone knows how can I make it works?

Tanks a lot
Peres

--
Peres




Peres

Differences concerning BackColor and ColorIndex
 
Tanks a lot . You dont imagine how much you help me!
--
Peres


"Tim Williams" wrote:

Color is a long (RGB) value and ColorIndex is the index (position) of a
color in the workbook color table.

Try:

Range("AF16").Interior.Color = Color1

Note that if you try to set a cell interior color to one which is not in the
workbook color table then Excel will use the "closest" color from the table
instead.


Tim

--
Tim Williams
Palo Alto, CA


"Peres" wrote in message
...
I 'd like to change a line color depending on the Backcolor of a

OptionButton
but when I ask :
Color1 = OptionButton1.BackColor

The result do not match to:
Range("AF16").Interior.ColorIndex = Color1

Does sameone knows how can I make it works?

Tanks a lot
Peres

--
Peres





Tom Ogilvy

Differences concerning BackColor and ColorIndex
 
Another source of information:

http://www.mvps.org/dmcritchie/excel/colors.htm

David McRitchie's page on colors and Excel.

--
Regards,
Tom Ogilvy


"Peres" wrote in message
...
Tanks a lot . You dont imagine how much you help me!
--
Peres


"Tim Williams" wrote:

Color is a long (RGB) value and ColorIndex is the index (position) of a
color in the workbook color table.

Try:

Range("AF16").Interior.Color = Color1

Note that if you try to set a cell interior color to one which is not in

the
workbook color table then Excel will use the "closest" color from the

table
instead.


Tim

--
Tim Williams
Palo Alto, CA


"Peres" wrote in message
...
I 'd like to change a line color depending on the Backcolor of a

OptionButton
but when I ask :
Color1 = OptionButton1.BackColor

The result do not match to:
Range("AF16").Interior.ColorIndex = Color1

Does sameone knows how can I make it works?

Tanks a lot
Peres

--
Peres








All times are GMT +1. The time now is 11:49 AM.

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