#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 101
Default Color Cells

What I would like to do is have a macro to do the following. Pick the FC
date and then go to the same date to the right and color & bold that cell
yellow and also color the two cells prior to that also yellow. Example:
Color Yellow Oct 07 - Nov 07 - Dec 07 for FC date

For CS date Jan 08; Feb 08 and Mar 08

Then pick the CS date and to the same except color these cells blue.

I only want to start with dates equal to or greater than January 2008.

FC date CS date Oct-07 Nov-07 Dec-07 Jan-08 Feb-08
19-Dec-07 26-Mar-08 0 0 0 0 0 0

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Color Cells


MyDate = Range("A2")
'get first day of month

ColCount = 3
Do While Cells(1, ColCount) < ""
If Month(MyDate) = Month(Cells(1, ColCount)) And _
Year(MyDate) = Year(Cells(1, ColCount)) Then

Exit Do
End If
ColCount = ColCount + 1
Loop

FirstCol = ColCount - 2
If FirstCol < 3 Then
FirstCol = 3
End If
For MyColumns = FirstCol To ColCount
Cells(2, MyColumns).Interior.ColorIndex = 6
Cells(2, MyColumns).Font.Bold = True

Next MyColumns
"Beep Beep" wrote:

What I would like to do is have a macro to do the following. Pick the FC
date and then go to the same date to the right and color & bold that cell
yellow and also color the two cells prior to that also yellow. Example:
Color Yellow Oct 07 - Nov 07 - Dec 07 for FC date

For CS date Jan 08; Feb 08 and Mar 08

Then pick the CS date and to the same except color these cells blue.

I only want to start with dates equal to or greater than January 2008.

FC date CS date Oct-07 Nov-07 Dec-07 Jan-08 Feb-08
19-Dec-07 26-Mar-08 0 0 0 0 0 0

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 101
Default Color Cells

Hi Joel:

A while back you gave me this macro, however it doesn't seem to want to
work. When I try to step into it (F8) it goes no where and no error
messages.

"Joel" wrote:


MyDate = Range("A2")
'get first day of month

ColCount = 3
Do While Cells(1, ColCount) < ""
If Month(MyDate) = Month(Cells(1, ColCount)) And _
Year(MyDate) = Year(Cells(1, ColCount)) Then

Exit Do
End If
ColCount = ColCount + 1
Loop

FirstCol = ColCount - 2
If FirstCol < 3 Then
FirstCol = 3
End If
For MyColumns = FirstCol To ColCount
Cells(2, MyColumns).Interior.ColorIndex = 6
Cells(2, MyColumns).Font.Bold = True

Next MyColumns
"Beep Beep" wrote:

What I would like to do is have a macro to do the following. Pick the FC
date and then go to the same date to the right and color & bold that cell
yellow and also color the two cells prior to that also yellow. Example:
Color Yellow Oct 07 - Nov 07 - Dec 07 for FC date

For CS date Jan 08; Feb 08 and Mar 08

Then pick the CS date and to the same except color these cells blue.

I only want to start with dates equal to or greater than January 2008.

FC date CS date Oct-07 Nov-07 Dec-07 Jan-08 Feb-08
19-Dec-07 26-Mar-08 0 0 0 0 0 0

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default Color Cells

did you put the code in a subroutine?

Sub test()

MyDate = Range("A2")
'get first day of month

ColCount = 3
Do While Cells(1, ColCount) < ""
If Month(MyDate) = Month(Cells(1, ColCount)) And _
Year(MyDate) = Year(Cells(1, ColCount)) Then

Exit Do
End If
ColCount = ColCount + 1
Loop

FirstCol = ColCount - 2
If FirstCol < 3 Then
FirstCol = 3
End If
For MyColumns = FirstCol To ColCount
Cells(2, MyColumns).Interior.ColorIndex = 6
Cells(2, MyColumns).Font.Bold = True

Next MyColumns

End Sub

"Beep Beep" wrote:

Hi Joel:

A while back you gave me this macro, however it doesn't seem to want to
work. When I try to step into it (F8) it goes no where and no error
messages.

"Joel" wrote:


MyDate = Range("A2")
'get first day of month

ColCount = 3
Do While Cells(1, ColCount) < ""
If Month(MyDate) = Month(Cells(1, ColCount)) And _
Year(MyDate) = Year(Cells(1, ColCount)) Then

Exit Do
End If
ColCount = ColCount + 1
Loop

FirstCol = ColCount - 2
If FirstCol < 3 Then
FirstCol = 3
End If
For MyColumns = FirstCol To ColCount
Cells(2, MyColumns).Interior.ColorIndex = 6
Cells(2, MyColumns).Font.Bold = True

Next MyColumns
"Beep Beep" wrote:

What I would like to do is have a macro to do the following. Pick the FC
date and then go to the same date to the right and color & bold that cell
yellow and also color the two cells prior to that also yellow. Example:
Color Yellow Oct 07 - Nov 07 - Dec 07 for FC date

For CS date Jan 08; Feb 08 and Mar 08

Then pick the CS date and to the same except color these cells blue.

I only want to start with dates equal to or greater than January 2008.

FC date CS date Oct-07 Nov-07 Dec-07 Jan-08 Feb-08
19-Dec-07 26-Mar-08 0 0 0 0 0 0

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
How to color automatically color code sums in cells kuroitenpi Charts and Charting in Excel 1 November 29th 06 03:16 AM
How do I apply color in cells ..color now shown only in print prev bonadimi Excel Worksheet Functions 1 April 25th 06 07:34 PM
change fill color of a range of cells based on color of a cell? DarMelNel Excel Programming 0 March 2nd 06 06:35 PM
Excel 2003 will not display color fonts or color fill cells DaveC Excel Worksheet Functions 1 April 11th 05 04:38 PM
My excel 2003 wont let me fill cells with color or color the tabs. trizog New Users to Excel 2 February 22nd 05 06:43 PM


All times are GMT +1. The time now is 01:46 AM.

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

About Us

"It's about Microsoft Excel"