Worksheet_Change Not Working

  • Thread starter Thread starter bw
  • Start date Start date
B

bw

This code is not executing when I put a 1 or 2 in Cell A1. Isn't it suppose
to? What have I done wrong?

Thanks,
Bernie

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Address = "$A$1" Then
Select Case Target.Value
Case Is = 1: MsgBox "A1 changed to 1"
Case Is = 2: MsgBox "A1 changed to 2"
End Select
End If
End Sub
 
Bernie

Works for me.

Where do you have the code stored?

Right-click on the Sheet tab and "View Code".

Paste the code in there.

Gord Dibben Excel MVP
 
This code is not executing when I put a 1 or 2 in Cell A1. Isn't it suppose
to? What have I done wrong?

Thanks,
Bernie

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
If Target.Address = "$A$1" Then
Select Case Target.Value
Case Is = 1: MsgBox "A1 changed to 1"
Case Is = 2: MsgBox "A1 changed to 2"
End Select
End If
End Sub

Works OK here.

If you open a new instance of Excel and create a new workbook, will it work
then?

Is it possible that in some other code, EnableEvents was disabled?

If so, try running this sub and then see if yours works.

=====================
Sub Enable()
Application.EnableEvents = True
End Sub
=====================


--ron
 
Thank you gentlemen,

I'm so dumb I don't even know how I'm able to ask for help. I put the code
not in the code for sheets, but in a new module. Now that you have
'splained, I kind of knew that I should have put in the sheets code.

Thanks for you patience with me.
Bernie
 
Back
Top