Font color setting problem

  • Thread starter Thread starter vrzimmerm
  • Start date Start date
V

vrzimmerm

I am trying to set the color of a range of cells based on the number
of a looping variable (Count). The following code gives me an
error indicating that the color can't be set using a variable name.
What would be an alternate way to do this?


For Count = 1 To 60

Sheets("Sheet3").Select
Range("B5").Select
Selection.Font.ColorIndex = Count

Thanks.
 
The ColorPalette for ColorIndex only has 56 colors. This will change so fast
that you will only see the first and last colors.

For Count = 1 To 56

Sheets("Sheet3").Range("B5").Font.ColorIndex = Count
Count = Count + 1
Next
 
I believe there are only 56 colors. To see all of them:

Sub test()
For Count = 1 To 56
Sheets("Sheet3").Select
Range("B" & Count + 4).Interior.ColorIndex = Count
Next Count
End Sub
 

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