Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello,
I would like to be able to change the formatting of a limited row of cells based on the date. By that I mean if an entered date is July 31, 2008, then one row of cells is formatted with a box around it, If August 31, 2008 another row is boxed in, etc. This would need to carry through all the sheets in the workbook (80+). There is a data entry box where the date is entered that is used for other coding, so I could point the code to that. The first cell in the row that is to be boxed has a date in it, and is part of a vlookup table, so I assume the code I'm looking for can use that table also? Below is the code I'm using, but right now it's a manual process to change the row I want boxed. I'd like to automate it without having to make 80 odd macros. Columns C through AB need to have the box around them. Also, can I clean up the formatting code at all? I would appreciate any help. Sub Macro2() ' ' Macro2 Macro ' Macro recorded 7/28/2008 by Lonnie Franklin Rudd ' Dim sh As Worksheet For i = 1 To Sheets.Count Set sh = Sheets(i) sh.Activate Range("C16:AB16").Select Selection.Borders(xlDiagonalDown).LineStyle = xlNone Selection.Borders(xlDiagonalUp).LineStyle = xlNone With Selection.Borders(xlEdgeLeft) .LineStyle = xlContinuous .Weight = xlMedium .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeTop) .LineStyle = xlContinuous .Weight = xlMedium .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeBottom) .LineStyle = xlContinuous .Weight = xlMedium .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeRight) .LineStyle = xlContinuous .Weight = xlMedium .ColorIndex = xlAutomatic End With Range("A1").Select Next i ' End Sub -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200807/1 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Change colour based on date | Excel Worksheet Functions | |||
I need the cells to change based on age of date. | Excel Discussion (Misc queries) | |||
How do I change date based on year | Excel Worksheet Functions | |||
how to add a value based on a date change in Excel? | Excel Worksheet Functions | |||
change date based on time | Excel Discussion (Misc queries) |