Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Font colours in cells. | Excel Discussion (Misc queries) | |||
Flashing message in cell (alternate font and background colors) | Excel Programming | |||
analysing data from alternate columns using the countif function | Excel Discussion (Misc queries) | |||
Excel 2003 font colours and cell colours | Excel Discussion (Misc queries) | |||
How to set different font colours in a cell? | Excel Worksheet Functions |