View Single Post
  #3   Report Post  
Mark F.
 
Posts: n/a
Default Change event fails to work

Ron Rosenfeld wrote:
On Thu, 10 Nov 2005 01:57:09 GMT, "Mark F" wrote:


In the change event handler I call a simple function that removes unwanted
characters from a string value, then returns the string. Simple huh? Well
I'm using Excel 2000 and this fails to work. Any reason why?

Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
Target.Value = CheckString(Target.Value)
Application.EnableEvents = True
End Sub


Thanks.
Mark



Assuming that there is no error in your CheckString function, I would guess
that in the debugging process you stopped the macro from running with
Application.EnableEvents still = False.

It's handy to have a sub to re-enable the events for this scenario.

Sub foo()
Application.EnableEvents=True
end sub


--ron


I used "on error goto" to trap any errors, then I reset events and
return. Works now, thanks Ron!