ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   coloring todays date (https://www.excelbanter.com/excel-programming/356488-coloring-todays-date.html)

J_J[_2_]

coloring todays date
 
I have rows of data containing date info in dd mm yyyy format on column J in
various sheets.
What VB code should I use in the workbook or module code page so that the
rows will be highlighted (or yellow colored) containing today's date on
column E?
TIA



Carim

coloring todays date
 
Hi J_J,

Had a similar problem ... adjust the following to your needs :
Private Sub Worksheet_Change(ByVal Target As Range)

Dim Cell As Range
Set Target = Range("J1:J200")
For Each Cell In Target
If Cell.Value = Now() Then
Cell.Offset(0, -8).Range("A1:L1").Interior.ColorIndex = 6
End If
If Cell.Value < Now() Then
Cell.Offset(0, -8).Range("A1:L1").Interior.ColorIndex =
xlNone
End If
Next Cell
End Sub

HTH
Cheers
Carim


Glen Mettler[_2_]

coloring todays date
 
Use conditional formating. It's instantaneous and it requires no vba code.

Glen
"J_J" wrote in message
...
I have rows of data containing date info in dd mm yyyy format on column J
in various sheets.
What VB code should I use in the workbook or module code page so that the
rows will be highlighted (or yellow colored) containing today's date on
column E?
TIA







All times are GMT +1. The time now is 05:32 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com