Disgruntled77
New Member
- Joined
- Oct 29, 2018
- Messages
- 1
Good day all,
I have reached the end of my own limited knowledge and ask if anyone here could help me?
I have a simple spreadsheet, column(5) "E", has a pulldown with values P1 thru P4. The following code simply places an 'X' in column "A" when P1 is selected, and removes the 'X' when any other value is chosen.
My problem is when any other cell is edited, I receive a 'Object variable or With block variable not set error'...
Any help is greatly appreciated.
Sincerely,
Ryan
I have reached the end of my own limited knowledge and ask if anyone here could help me?
I have a simple spreadsheet, column(5) "E", has a pulldown with values P1 thru P4. The following code simply places an 'X' in column "A" when P1 is selected, and removes the 'X' when any other value is chosen.
My problem is when any other cell is edited, I receive a 'Object variable or With block variable not set error'...
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo Whoa
If Target.Cells.CountLarge > 1 Then Exit Sub
Application.EnableEvents = False
If Intersect(Target, Columns(5)) = "P1" Then
If Target.Row > 1 Then
Range("A" & Target.Row).Value = "X"
End If
End If
If Not Intersect(Target, Columns(5)) = "P1" Then
If Target.Row > 1 Then
Range("A" & Target.Row).Value = ""
End If
End If
Letscontinue:
Application.EnableEvents = True
Exit Sub
Whoa:
MsgBox Err.Description
Resume Letscontinue
End Sub
Any help is greatly appreciated.
Sincerely,
Ryan