Home |
Search |
Today's Posts |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Vlookup doesn't work until i edit(but not change) the lookup cell | Excel Worksheet Functions | |||
Hyperlinks change path on save in Excel 2003 | Excel Worksheet Functions | |||
How to copy the work sheets from different workbooks into one? | Excel Discussion (Misc queries) | |||
Change cell back color on click | Excel Discussion (Misc queries) | |||
Change Path names in copied work book | Excel Worksheet Functions |