![]() |
Set cell background based on date.
I saw a post similar to this earlier this week. I However i was unbale to get
it to work. My question is: I am working a caladar for work. I want a certian set of cells to be highlighted, color is unimportant, based on todays date. So if I open the workbook today, Oct. 28th will be highlighted. Tomorrow Oct 29th will be highlighted. Thanks for your help, Steve |
Set cell background based on date.
sorry for the multiple postings. The first time i submitted it, i got an
error message. Steve "Steve" wrote: I saw a post similar to this earlier this week. I However i was unbale to get it to work. My question is: I am working a caladar for work. I want a certian set of cells to be highlighted, color is unimportant, based on todays date. So if I open the workbook today, Oct. 28th will be highlighted. Tomorrow Oct 29th will be highlighted. Thanks for your help, Steve |
Set cell background based on date.
Steve,
This will get you started. Drop this into the worksheet's module. Option Explicit Private Sub Worksheet_Activate() Dim rngCell As Range For Each rngCell In Me.Range(Me.Cells(1, 1), Me.Cells.SpecialCells(xlCellTypeLastCell)) If rngCell.Value = Date Then rngCell.Interior.Color = RGB(0, 0, 225) ElseIf rngCell.Value = Date + 1 Then rngCell.Interior.Color = RGB(255, 255, 0) ElseIf IsDate(rngCell.Value) Then rngCell.Interior.ColorIndex = xlColorIndexNone End If Next End Sub "Steve" wrote: sorry for the multiple postings. The first time i submitted it, i got an error message. Steve "Steve" wrote: I saw a post similar to this earlier this week. I However i was unbale to get it to work. My question is: I am working a caladar for work. I want a certian set of cells to be highlighted, color is unimportant, based on todays date. So if I open the workbook today, Oct. 28th will be highlighted. Tomorrow Oct 29th will be highlighted. Thanks for your help, Steve |
All times are GMT +1. The time now is 09:10 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com