ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,832
- Office Version
- 2007
- Platform
- Windows
Hi,
I am using the code below which works fine.
What i am having an issue with now is trying to add something like the below into the code above.
The code needs to work for any cell in column B so when a value is typed into the cell the 10th character will be shown in a Red font colour.
I am using the code below which works fine.
Code:
Private Sub Worksheet_Change(ByVal Target As Range) Dim c As Range
On Error GoTo AllowEvents
If Target.Count > 1000 Then Exit Sub
If Not Intersect(Target, Range("B:B")) Is Nothing Then
For Each c In Target
If c.Row > 5 And c.Column = 2 Then
If Len(c.Value) <> 17 And Len(c.Value) > 0 Then
Application.EnableEvents = False
MsgBox "VIN MUST BE 17 CHARACTERS", vbCritical, "VIN CHARACTER COUNT MESSAGE"
c.Value = ""
c.Select
End If
End If
Next
End If
AllowEvents:
Application.EnableEvents = True
End Sub
What i am having an issue with now is trying to add something like the below into the code above.
Code:
Range("B").Characters(Start:=10, Length:=1).Font.ColorIndex = 3
The code needs to work for any cell in column B so when a value is typed into the cell the 10th character will be shown in a Red font colour.