ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How do I watch a variable change value during Visual Basic Code e. (https://www.excelbanter.com/excel-programming/319240-how-do-i-watch-variable-change-value-during-visual-basic-code-e.html)

Stewart1234

How do I watch a variable change value during Visual Basic Code e.
 
How do I watch a variable in an excel macro change value as the visual basic
code is running? The variable changes value every 30 seconds or so and I want
to monitor progress of the execution by looking at the value without stopping
the run.



Paulw2k

How do I watch a variable change value during Visual Basic Code e.
 
Hi

One way is to add a line after the variable changes which would show the
message box displaying the new variable value:

MsgBox MyVariable

Once you know everything is working correctly remember to remove the line
from your code.

Regards

Paul




"Stewart1234" wrote in message
...
How do I watch a variable in an excel macro change value as the visual
basic
code is running? The variable changes value every 30 seconds or so and I
want
to monitor progress of the execution by looking at the value without
stopping
the run.





Frank Kabel

How do I watch a variable change value during Visual Basic Code e.
 
Hi
in the VBE Editor just define a watch for this variable

--
Regards
Frank Kabel
Frankfurt, Germany

Stewart1234 wrote:
How do I watch a variable in an excel macro change value as the
visual basic code is running? The variable changes value every 30
seconds or so and I want to monitor progress of the execution by
looking at the value without stopping the run.




Bob Phillips[_6_]

How do I watch a variable change value during Visual Basic Code e.
 
Stewart,

Watch needs an interrupt to output the details. So, single-stepping, or
break points will provide such an interrupt, but otherwise I think you are
stymied.

You could add an Ontime call for every 30 seconds and do a Debug.Print of
that variable (but you will need to make it global, not procedure variable).

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Stewart1234" wrote in message
...
How do I watch a variable in an excel macro change value as the visual

basic
code is running? The variable changes value every 30 seconds or so and I

want
to monitor progress of the execution by looking at the value without

stopping
the run.





Patrick Molloy[_2_]

How do I watch a variable change value during Visual Basic Code e.
 
After the line where the code changes the variable's value add this:

Application.Statusbar = variablename


Patrick Molloy
Microsoft Excel MVP


"Stewart1234" wrote:

How do I watch a variable in an excel macro change value as the visual basic
code is running? The variable changes value every 30 seconds or so and I want
to monitor progress of the execution by looking at the value without stopping
the run.



Stewart1234

How do I watch a variable change value during Visual Basic Cod
 
Thanks, that was very helpful, especially once I found the statusbar.

Is there a way to display this on the VBE editor screen? When the workbook
is displayed there is a lot of activity on the worksheets - numbers flying
everywhere,
and I like to cover this by expanding the VBE editor screen to full size,
but it covers the
status bar. I tried balloons, msgbox, textbox, etc but none of those had a
display only feature, they always waited for an event before execution would
continue.

"Patrick Molloy" wrote:

After the line where the code changes the variable's value add this:

Application.Statusbar = variablename


Patrick Molloy
Microsoft Excel MVP


"Stewart1234" wrote:

How do I watch a variable in an excel macro change value as the visual basic
code is running? The variable changes value every 30 seconds or so and I want
to monitor progress of the execution by looking at the value without stopping
the run.



Patrick Molloy[_2_]

How do I watch a variable change value during Visual Basic Cod
 
in the code add:

Debug.Print variablename

"Stewart1234" wrote:

Thanks, that was very helpful, especially once I found the statusbar.

Is there a way to display this on the VBE editor screen? When the workbook
is displayed there is a lot of activity on the worksheets - numbers flying
everywhere,
and I like to cover this by expanding the VBE editor screen to full size,
but it covers the
status bar. I tried balloons, msgbox, textbox, etc but none of those had a
display only feature, they always waited for an event before execution would
continue.

"Patrick Molloy" wrote:

After the line where the code changes the variable's value add this:

Application.Statusbar = variablename


Patrick Molloy
Microsoft Excel MVP


"Stewart1234" wrote:

How do I watch a variable in an excel macro change value as the visual basic
code is running? The variable changes value every 30 seconds or so and I want
to monitor progress of the execution by looking at the value without stopping
the run.




All times are GMT +1. The time now is 07:05 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com