![]() |
Input Color Scheme for Date Column
I have a column in Excel that has only dates inputed. I would like to wright
a macro that would look at the dates and do the following: If the date is older than 30 days from the current date then make the active cell color Red If the date is greater than the current date then make the active cell green Thanks Frank |
Input Color Scheme for Date Column
Sub colr()
If Now - ActiveCell.Value 30 Then ActiveCell.Interior.ColorIndex = 3 ElseIf ActiveCell.Value Now Then ActiveCell.Interior.ColorIndex = 10 End If End Sub "Beep Beep" wrote: I have a column in Excel that has only dates inputed. I would like to wright a macro that would look at the dates and do the following: If the date is older than 30 days from the current date then make the active cell color Red If the date is greater than the current date then make the active cell green Thanks Frank |
Input Color Scheme for Date Column
JLGWhiz
Works great, however (when did you hear that last). The number of rows is not consistant so I guess I need a loop until it gets to a blank cell. Can you help me with this. Thanks Frank "JLGWhiz" wrote: Sub colr() If Now - ActiveCell.Value 30 Then ActiveCell.Interior.ColorIndex = 3 ElseIf ActiveCell.Value Now Then ActiveCell.Interior.ColorIndex = 10 End If End Sub "Beep Beep" wrote: I have a column in Excel that has only dates inputed. I would like to wright a macro that would look at the dates and do the following: If the date is older than 30 days from the current date then make the active cell color Red If the date is greater than the current date then make the active cell green Thanks Frank |
Input Color Scheme for Date Column
Good Morning JLGWhiz
I imputed a Do statement to stop at a blank cell, and now this brings up the question how to go past the blank cell (no date inputed) and or a ? inputed. Thanks Frank "JLGWhiz" wrote: Sub colr() If Now - ActiveCell.Value 30 Then ActiveCell.Interior.ColorIndex = 3 ElseIf ActiveCell.Value Now Then ActiveCell.Interior.ColorIndex = 10 End If End Sub "Beep Beep" wrote: I have a column in Excel that has only dates inputed. I would like to wright a macro that would look at the dates and do the following: If the date is older than 30 days from the current date then make the active cell color Red If the date is greater than the current date then make the active cell green Thanks Frank |
All times are GMT +1. The time now is 05:27 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com