need codeto view the 56 colors of ColorIndex

  • Thread starter Thread starter SuitedAces
  • Start date Start date
S

SuitedAces

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
 
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top