![]() |
Formatting columns of data with alternate font colours
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 |
Formatting columns of data with alternate font colours
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 "matt3542" wrote: 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 |
Formatting columns of data with alternate font colours
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 "matt3542" wrote: 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 |
Formatting columns of data with alternate font colours
Dear Joel
Thankyou so much for taking the time to help, this worked exactly as intended. Regards Matt "Joel" wrote: 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 "matt3542" wrote: 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 |
Formatting columns of data with alternate font colours
Dear Mike,
Thankyou for this, it worked perfectly, very much appreciated Regards Matt "Mike H" wrote: 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 "matt3542" wrote: 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 |
All times are GMT +1. The time now is 02:30 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com