Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Stop on variable
Hi,
does anyone know if it is possible to stop the VBA-code when it reaches (the first) variable I have in mind. eg. I am tracing for a variable when it changes from value but I don't know anymore where it stands in my procedures, so I should like to ask excel to stop whenever it encounters this specific variable (in stead of setting the red dot in the margin or using the command Stop) Thanks, Jos Vens |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Stop on variable
Where you defined the variable, define it wrong type.
E.g. Define the variable as Boolean, if actually it will be a string. Or define it as Range if it is not going to a range at all. Remove any On Error commands in the code. So when the variable is first reached to assining a value, or to check its value, you will get error 'Type Mismatch' or 'Object Variable or With Block variable not set'. Sharad *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Stop on variable
Sorry Sharad,
I was thinking of a tool embedded in the VBA environment like the window Direct where you can put the name of a variable and then Excel stops when it encounters it. I'm not prepared to run through thousands of lines to see if the On Error is set or not. Thanks anyway, Jos "Sharad" schreef in bericht ... Where you defined the variable, define it wrong type. E.g. Define the variable as Boolean, if actually it will be a string. Or define it as Range if it is not going to a range at all. Remove any On Error commands in the code. So when the variable is first reached to assining a value, or to check its value, you will get error 'Type Mismatch' or 'Object Variable or With Block variable not set'. Sharad *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Stop on variable
Inside the VBE:
Debug|Add watch There's an option to "break when value changes" Jos Vens wrote: Hi, does anyone know if it is possible to stop the VBA-code when it reaches (the first) variable I have in mind. eg. I am tracing for a variable when it changes from value but I don't know anymore where it stands in my procedures, so I should like to ask excel to stop whenever it encounters this specific variable (in stead of setting the red dot in the margin or using the command Stop) Thanks, Jos Vens -- Dave Peterson |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Stop on variable
Thanks Dave,
it works perfect for tracing changing values of variables! However, I also like to trace defined names like [myName]. If I add the control to the window, it stops on every line of my code. Is this not possible? Jos "Dave Peterson" schreef in bericht ... Inside the VBE: Debug|Add watch There's an option to "break when value changes" Jos Vens wrote: Hi, does anyone know if it is possible to stop the VBA-code when it reaches (the first) variable I have in mind. eg. I am tracing for a variable when it changes from value but I don't know anymore where it stands in my procedures, so I should like to ask excel to stop whenever it encounters this specific variable (in stead of setting the red dot in the margin or using the command Stop) Thanks, Jos Vens -- Dave Peterson |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Stop on variable
I couldn't do it.
I'm guessing that since the value in that range could change any time, VBA sees it as something that might have changed. (But that's just a guess.) Jos Vens wrote: Thanks Dave, it works perfect for tracing changing values of variables! However, I also like to trace defined names like [myName]. If I add the control to the window, it stops on every line of my code. Is this not possible? Jos "Dave Peterson" schreef in bericht ... Inside the VBE: Debug|Add watch There's an option to "break when value changes" Jos Vens wrote: Hi, does anyone know if it is possible to stop the VBA-code when it reaches (the first) variable I have in mind. eg. I am tracing for a variable when it changes from value but I don't know anymore where it stands in my procedures, so I should like to ask excel to stop whenever it encounters this specific variable (in stead of setting the red dot in the margin or using the command Stop) Thanks, Jos Vens -- Dave Peterson -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
why is it saying sheetcnt is "variable not defined" how to do a global variable to share over multiple functions in vba for excel? | Excel Worksheet Functions | |||
How do I stop other circles in other cells to stop selecting? | Excel Worksheet Functions | |||
How do I stop other circles in other boxes to stop selecting? | Excel Worksheet Functions | |||
Macro: With Stop it works. Without Stop it doesn't. | Excel Programming | |||
Cells.Find error Object variable or With block variable not set | Excel Programming |