Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Mark F
 
Posts: n/a
Default Change event fails to work

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


  #2   Report Post  
Ron Rosenfeld
 
Posts: n/a
Default Change event fails to work

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
  #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!
  #4   Report Post  
Ron Rosenfeld
 
Posts: n/a
Default Change event fails to work



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!


Happy to help. Glad you have it working now.

Best wishes,

--ron
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Vlookup doesn't work until i edit(but not change) the lookup cell Confused Excel Worksheet Functions 4 November 8th 05 09:15 AM
Hyperlinks change path on save in Excel 2003 Flyboy Excel Worksheet Functions 1 November 5th 05 04:53 PM
How to copy the work sheets from different workbooks into one? Sesh Excel Discussion (Misc queries) 1 April 15th 05 06:03 PM
Change cell back color on click Dave Peterson Excel Discussion (Misc queries) 0 January 24th 05 10:50 PM
Change Path names in copied work book jheaney Excel Worksheet Functions 2 November 18th 04 07:29 PM


All times are GMT +1. The time now is 08:27 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"