ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,731
- Office Version
- 2007
- Platform
- Windows
Afternoon,
Working code in use shown below.
Currently this code operates the whole of column B where i would like it to stop at the last row.
So currently my last row with data in is row 19 BUT then i also see the message if i type in row 369 where at present its empty.
Basically find last row with data in and only have that row & up the page working with this code.
As time goes on my last row will be futher down the page.
Working code in use shown below.
Currently this code operates the whole of column B where i would like it to stop at the last row.
So currently my last row with data in is row 19 BUT then i also see the message if i type in row 369 where at present its empty.
Basically find last row with data in and only have that row & up the page working with this code.
As time goes on my last row will be futher down the page.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim c As Range
On Error GoTo AllowEvents
Application.EnableEvents = False
Application.ScreenUpdating = False
For Each c In Target
If c.Row > 6 And c.Column < 11 And Not IsEmpty(c) Then
If Not c.HasFormula Then
c.Value = UCase(c.Value)
Else
c.Formula = Replace(c.Formula, "=", "=UPPER(") & ")"
End If
End If
Next c
If Target.CountLarge > 1000 Then GoTo AllowEvents
If Not Intersect(Target, Range("B:B")) Is Nothing Then
For Each c In Intersect(Target, Range("B:B"))
If c.Row > 6 Then
If Len(c.Value) <> 17 And Len(c.Value) > 0 Then
MsgBox "VIN MUST BE 17 CHARACTERS", vbCritical, "VIN CHARACTER COUNT MESSAGE"
c.Value = ""
c.Select
GoTo AllowEvents
Else
c.Characters(Start:=10, Length:=1).Font.ColorIndex = 3
End If
End If
Next c
If Range("B7") = "" Then Range("E7") = ""
End If
AllowEvents:
Application.ScreenUpdating = True
Application.EnableEvents = True
Range("B7").Characters(Start:=10, Length:=1).Font.ColorIndex = 3
End Sub