I'd like a macro to identify cells with only 4 characters (i.e. a yea
like 1989) and if the cell has only 4 characters, to make th
characters in the cell to the right of it bold red. For example, i
cell A29 is 1933, the characters in cell B29 should be in bold red.
Thanks for your help
Carim - 22 Mar 2006 17:05 GMT
Hi Sandeman,
Give a try to following :
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Cell As Range
Set Target = Range("A1:A50")
If Target Is Nothing Then
Exit Sub
Else
For Each Cell In Target
If Len(Cell.Value) = 4 Then
Cell.Offset(0, 1).Range("A1").Interior.ColorIndex = 3
End If
If Len(Cell.Value) <> 4 Then
Cell.Offset(0, 1).Range("A1").Interior.ColorIndex = xlNone
End If
Next Cell
End If
End Sub
HTH
Carim
Sandeman - 23 Mar 2006 09:27 GMT
Wonderful. Thank you Carim