If a cell is modified after a date; font color change indicate

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

In XLS, if a cell value is changed after a fixed date can the font color be
directed to change in order to indicate this.
 
Right-click on the sheet tab to display VBA code for the sheet. Then
paste the following code and change the range of cells and the date as
needed.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim MonitoredRange As Range
Dim LimitDate As Date
Dim inter As Range

Set MonitoredRange = Range("A1") 'You can change this to an array, e.g.
Range("A1:A10")
LimitDate = "11/15/2005"

Set inter = Application.Intersect(MonitoredRange, Target)
If (Not inter Is Nothing) And (Now > Int(LimitDate)) Then
Target.Font.ColorIndex = 3
End If

End Sub

HTH
Kostis Vezerides
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top