
Ta very much!


NuclearSilo wrote:You have to learn VBA to do it:
- read the content of a CeLL
- analyse the date from the string
- compare
- highlight the CeLL

Code: Select all
Private Sub CommandButton1_Click()
If Range("T8").Value > 365 Then
With Range("S8").Font
.Color = -16776961
.Bold = True
End With
Else
With Range("S8").Font
.ColorIndex = xlAutomatic
.Bold = False
End With
End If
If Range("T9").Value > 365 Then
With Range("S9").Font
.Color = -16776961
.Bold = True
End With
Else
With Range("S9").Font
.ColorIndex = xlAutomatic
.Bold = False
End With
End If
If Range("T10").Value > 365 Then
With Range("S10").Font
.Color = -16776961
.Bold = True
End With
Else
With Range("S10").Font
.ColorIndex = xlAutomatic
.Bold = False
End With
End If
End Sub

CeLL wrote:NuclearSilo wrote:You have to learn VBA to do it:
- read the content of a CeLL
- analyse the date from the string
- compare
- highlight the CeLL
you just cant stop talkin about me can you silo?
Code: Select all
Sub HighlightExpired()
Rng = Selection.Rows.Count
Dim value As Date
Dim str As String
Selection.NumberFormat = "dd/mm/yyyy"
For i = 1 To Rng
str = ActiveCell.Cells(i)
If str <> "" Then
value = str
If DateDiff("d", value, Date) > 365 Then 'if > 365 day
'1=black, 2=white, 3=red, 4=green, 5=blue, 6=yellow
ActiveCell.Cells(i).Interior.ColorIndex = 3
End If
End If
Next i
End Sub
