Ark68
Well-known Member
- Joined
- Mar 23, 2004
- Messages
- 4,616
- Office Version
- 365
- 2016
- Platform
- Windows
This is code I have in my worksheet module. It is supposed recognize changes to cells D4 or D5. It doesn't appear to be working. When I enter a value in D4 and hit TAB or RETURN, nothing happens. It jumps to the line I highlighted in red. Looking for discussion as to what I did wrong.
Rich (BB code):
Private Sub Worksheet_Change(ByVal Target As Range)
If Not mbevents Then Exit Sub
Application.ScreenUpdating = False
Unprotect
If Not Intersect(Target, Range("$D$4")) Is Nothing Then
If Range("D4") = "Surname, Given" Then
With Range("D4")
.Value = "Surname, Given"
.Font.Italic = True
.Font.Color = RGB(30, 155, 162)
.Font.Size = 8
End With
Else
With Range("D4")
uname = .Value
.Font.Italic = False
.Font.Color = RGB(19, 65, 98)
.Font.Size = 11
End With
End If
Range("D5").Select
End If
If Not Intersect(Target, Range("$D$5")) Is Nothing Then
Stop
If Range("D5") = "Select" Then
With Range("D5")
.Value = "Select"
.Font.Italic = True
.Font.Color = RGB(30, 155, 162)
.Font.Size = 8
End With
Else
With Range("D5")
wcentre = .Value
.Font.Italic = False
.Font.Color = RGB(19, 65, 98)
.Font.Size = 11
End With
End If
End If
Protect
Call AddScreenTipTextToColumnC
Stop
Initiate1
Application.ScreenUpdating = True
End Sub