- Joined
- Dec 13, 2017
- Messages
- 71
- Reaction score
- 19
I am have cell range B3:B327 that is initially entered by user & several other cells are activated by the entry.
I currently have code that runs when there is a change in column M. Here is the code:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
'Instructs user what to do once pending is entered in Column M.
If Intersect(Target, Range("M:M")) Is Nothing Then Exit Sub
If Target.Value = "Pending" Then
MsgBox "Enter the name on the Outlook Calendar, for a letter (Date in Red & Cancel 2 weeks later. If No response)." & vbCrLf
Else
End If
End Sub
I have tried modifying the above code, if the value changes in Cell range B3:B327. I get no response using <>. I have found code looking for specific text, but not going from empty. A friend tried to help my & I had the same response, (No response). Here is his code:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Intersect(Target, Range("B2:B17")) Is Nothing Then Exit Sub
Dim OldVal As Variant, NewVal As Variant
Application.EnableEvents = False
NewVal = Target.Value
Application.Undo
OldVal = Target.Value
' Test Cell's Previous State
If IsEmpty(OldVal) Then
MsgBox " Cell Originally Empty ..."
Else
MsgBox " Cell already Populated ..."
End If
' Accept New Value
Target.Value = NewVal
Application.EnableEvents = True
End Sub
What am I doing wrong?
I currently have code that runs when there is a change in column M. Here is the code:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
'Instructs user what to do once pending is entered in Column M.
If Intersect(Target, Range("M:M")) Is Nothing Then Exit Sub
If Target.Value = "Pending" Then
MsgBox "Enter the name on the Outlook Calendar, for a letter (Date in Red & Cancel 2 weeks later. If No response)." & vbCrLf
Else
End If
End Sub
I have tried modifying the above code, if the value changes in Cell range B3:B327. I get no response using <>. I have found code looking for specific text, but not going from empty. A friend tried to help my & I had the same response, (No response). Here is his code:
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Then Exit Sub
If Intersect(Target, Range("B2:B17")) Is Nothing Then Exit Sub
Dim OldVal As Variant, NewVal As Variant
Application.EnableEvents = False
NewVal = Target.Value
Application.Undo
OldVal = Target.Value
' Test Cell's Previous State
If IsEmpty(OldVal) Then
MsgBox " Cell Originally Empty ..."
Else
MsgBox " Cell already Populated ..."
End If
' Accept New Value
Target.Value = NewVal
Application.EnableEvents = True
End Sub
What am I doing wrong?