ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   need codeto view the 56 colors of ColorIndex (https://www.excelbanter.com/excel-programming/365900-need-codeto-view-56-colors-colorindex.html)

SuitedAces[_14_]

need codeto view the 56 colors of ColorIndex
 

Help with this please

I trying to write for a buton the will change a cell color
each press will increment the ColorIndex property.

Also a question ...does the ColorIndex # relate directly to the colo

pallet used when changing a cell color manually?
They dont seem to correspond.

Thank you for the hel

--
SuitedAce
-----------------------------------------------------------------------
SuitedAces's Profile: http://www.excelforum.com/member.php...fo&userid=3584
View this thread: http://www.excelforum.com/showthread.php?threadid=55718


Leith Ross[_615_]

need codeto view the 56 colors of ColorIndex
 

Hello SuitedAces,

The pallet is arranged by color not by color index values.

Here is a macro that will change the active cell's background color
according to the color index sequentially. It places the color index in
the cell to the right. You can comment this line out if you like.


Code:
--------------------

Sub ChangeColor()

Dim N As Integer
Static CI As Integer

CI = CI + 1
With ActiveCell
N = CI Mod 57
.Interior.ColorIndex = N
.Offset(0, 1).Value = N
End With

End Sub

--------------------


Sincerely,
Leith Ross


--
Leith Ross
------------------------------------------------------------------------
Leith Ross's Profile: http://www.excelforum.com/member.php...o&userid=18465
View this thread: http://www.excelforum.com/showthread...hreadid=557183


SuitedAces[_15_]

need codeto view the 56 colors of ColorIndex
 

Thank you very much.

I am a beginner and struggling with using variables for looping
and trying to figure out where I need to declare the variables.

This will help clue me in

--
SuitedAce
-----------------------------------------------------------------------
SuitedAces's Profile: http://www.excelforum.com/member.php...fo&userid=3584
View this thread: http://www.excelforum.com/showthread.php?threadid=55718



All times are GMT +1. The time now is 01:13 AM.

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