Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to color automatically color code sums in cells | Charts and Charting in Excel | |||
How do I apply color in cells ..color now shown only in print prev | Excel Worksheet Functions | |||
change fill color of a range of cells based on color of a cell? | Excel Programming | |||
Excel 2003 will not display color fonts or color fill cells | Excel Worksheet Functions | |||
My excel 2003 wont let me fill cells with color or color the tabs. | New Users to Excel |