Formatting columns of data with alternate font colours

M

matt3542

Dear Forum,

As a complete novice to VBA I would appreciate any advice/solutions to help
solve the following problem;

I have 9 columns of numerical data (A to I) and I would like to use VBA code
to alternate the font colours in each column from red to blue moving left to
right.

As always any help is gratefully received
Thanks
Matt
 
J

Joel

Sub Colors()

ColorRed = True
For ColCount = 1 To Columns.Count
If ColorRed = True Then
Columns(ColCount).Interior.ColorIndex = 3
ColorRed = False
Else
Columns(ColCount).Interior.ColorIndex = 5
ColorRed = True
End If

Next ColCount

End Sub
 
M

Mike H

Hi,

Right click your sheet tab, view code and paste this in and run it

Sub marine()
For x = 1 To 9
If x Mod 2 = 0 Then
Columns(x).Font.ColorIndex = 41
Else
Columns(x).Font.ColorIndex = 3
End If
Next
End Sub

Mike
 
M

matt3542

Dear Joel

Thankyou so much for taking the time to help, this worked exactly as
intended.

Regards
Matt
 
M

matt3542

Dear Mike,

Thankyou for this, it worked perfectly, very much appreciated

Regards
Matt
 

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

Top