Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default 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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default 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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default 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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Font colours in cells. Value increases with increase in font.[_2_] Excel Discussion (Misc queries) 3 March 25th 09 03:22 PM
Flashing message in cell (alternate font and background colors) [email protected] Excel Programming 1 October 14th 05 03:25 PM
analysing data from alternate columns using the countif function Juniper Excel Discussion (Misc queries) 3 April 28th 05 04:12 PM
Excel 2003 font colours and cell colours bretta Excel Discussion (Misc queries) 1 April 17th 05 03:45 AM
How to set different font colours in a cell? Sam Excel Worksheet Functions 1 March 29th 05 01:53 AM


All times are GMT +1. The time now is 10:19 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"