Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 273
Default How To Use Debug

Greetings,

I have a UserForm that is giving me fits. I need to follow the code
as executes and see where the variables are being changed.

But I don't know how to use Debug!

Can someone show me how? or point me in the right direction?

Any assistance would be appreciated.

As always, Thanks in Advance.

-Minitman
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default How To Use Debug

Select a line early in the code and add a breakpoint - F9.

Then when the code stops at that line, step through one line at a time - F8.

You can then hover over variables to see the value, select an expression and
Shift-F9 to get it evaluated, print a variable to the immediate window
(?myVar), or add a variable or property to the watch window.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Minitman" wrote in message
...
Greetings,

I have a UserForm that is giving me fits. I need to follow the code
as executes and see where the variables are being changed.

But I don't know how to use Debug!

Can someone show me how? or point me in the right direction?

Any assistance would be appreciated.

As always, Thanks in Advance.

-Minitman



  #3   Report Post  
Posted to microsoft.public.excel.programming
GB GB is offline
external usenet poster
 
Posts: 230
Default How To Use Debug

Since you are talking about debugging a userform and not a module. My
suggestion would be to go into the code of the userform. Find a line in
which you would like to start tracing. Press the F9 key. This inserts a
stop point in your code.

Run whatever it is that causes your form to be displayed.. (Provided that it
is only displayed when opening the workbook. If so, then just go to the
ThisWorkbook code where Workbook_Open is. Select a row in that sub routine,
then press the F5 key. F5 runs the current sub routine/function.)

When the program gets to the line of code that has the stop point (Red line)
you can step through, over, out, etc your code. Review the key shortcuts
that are provided in the Debug drop down window. And perhaps refer to the
VBA help of the debug to understand 1) what each option does, and 2) learn
the shortcut keys to speed your debugging. You could also show the debug
toolbar, which may help in all of this also. :)

You also have two utility windows at your service, you have a watch window
and an immediate window. The watch window will show you the value(s) of
variables making it easy to trace. The immediate window can be used to show
the value of a variable if you want, but can be painful. :) To "print"
something preface it with a question mark: (i.e., ? activesheet.name) If you
want to assign/reassign a variable to test a limit you can just do that in
the immediate window when you have stopped at an appropriate location.

I.e., I=10

Hopefully this stuff will get you started.

"Minitman" wrote:

Greetings,

I have a UserForm that is giving me fits. I need to follow the code
as executes and see where the variables are being changed.

But I don't know how to use Debug!

Can someone show me how? or point me in the right direction?

Any assistance would be appreciated.

As always, Thanks in Advance.

-Minitman

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 273
Default How To Use Debug

Thanks Bob. That helps

On Wed, 18 Jan 2006 17:26:34 -0000, "Bob Phillips"
wrote:

Select a line early in the code and add a breakpoint - F9.

Then when the code stops at that line, step through one line at a time - F8.

You can then hover over variables to see the value, select an expression and
Shift-F9 to get it evaluated, print a variable to the immediate window
(?myVar), or add a variable or property to the watch window.


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 273
Default How To Use Debug

Even better, Thank you very much.

-Minitman

On Wed, 18 Jan 2006 09:33:02 -0800, "GB"
wrote:

Since you are talking about debugging a userform and not a module. My
suggestion would be to go into the code of the userform. Find a line in
which you would like to start tracing. Press the F9 key. This inserts a
stop point in your code.

Run whatever it is that causes your form to be displayed.. (Provided that it
is only displayed when opening the workbook. If so, then just go to the
ThisWorkbook code where Workbook_Open is. Select a row in that sub routine,
then press the F5 key. F5 runs the current sub routine/function.)

When the program gets to the line of code that has the stop point (Red line)
you can step through, over, out, etc your code. Review the key shortcuts
that are provided in the Debug drop down window. And perhaps refer to the
VBA help of the debug to understand 1) what each option does, and 2) learn
the shortcut keys to speed your debugging. You could also show the debug
toolbar, which may help in all of this also. :)

You also have two utility windows at your service, you have a watch window
and an immediate window. The watch window will show you the value(s) of
variables making it easy to trace. The immediate window can be used to show
the value of a variable if you want, but can be painful. :) To "print"
something preface it with a question mark: (i.e., ? activesheet.name) If you
want to assign/reassign a variable to test a limit you can just do that in
the immediate window when you have stopped at an appropriate location.

I.e., I=10

Hopefully this stuff will get you started.

"Minitman" wrote:

Greetings,

I have a UserForm that is giving me fits. I need to follow the code
as executes and see where the variables are being changed.

But I don't know how to use Debug!

Can someone show me how? or point me in the right direction?

Any assistance would be appreciated.

As always, Thanks in Advance.

-Minitman


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
DeBug Ollie Excel Discussion (Misc queries) 4 April 28th 06 03:17 PM
help with debug Rusty New Users to Excel 3 February 2nd 05 03:16 AM
debug John Excel Programming 0 September 22nd 04 04:11 AM
help with debug Jim May Excel Programming 2 August 10th 04 01:04 PM
debug help Tom Ogilvy Excel Programming 0 August 27th 03 07:10 PM


All times are GMT +1. The time now is 10:57 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"