Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default 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.




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default 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.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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.




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default 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.




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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.


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default 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.


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
Visual Basic - Variable Sheet Names MarkT Excel Discussion (Misc queries) 10 December 18th 07 07:12 PM
I need a visual basic code....please Rhonda Excel Discussion (Misc queries) 1 March 5th 07 01:18 PM
visual basic code Whitey Excel Programming 1 October 26th 04 04:05 PM
Visual Basic Code Robert Couchman Excel Programming 2 February 2nd 04 03:10 PM
Visual Basic Range variable Andrew Johnson Excel Programming 2 August 25th 03 05:18 PM


All times are GMT +1. The time now is 01:14 AM.

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"