View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
NickHK NickHK is offline
external usenet poster
 
Posts: 4,391
Default How do I step a Macro through a spreadsheet

First, it's easier to arrange the VBA IDE window and the Excel window so you
can see both at the both together.
Put a breakpoint on the line of code from which you want to start stepping
through: Left click in the left hand border of the window that contains the
code you want to examine. You will get a red dot in the border and that
whole line will have be red. It must be an executable line of code i.e NOT a
comment or Dim .
Trigger you code however it is supposed to start.
When you are in Break Mode (by your break point being reached, you can step
through the code line-by-line by pressing the F8 keys.
You can enter any valid code the Immediate (debug) window, to either set a
value or query a value, then press Enter:
To check:
?activecell.address [Enter]
To set
activecell.value="New Value" [Enter]

You can remove breakpoints by clicking on the red dot again.

Check out Debug in the VBA Help.

NickHK

"Sarahds" wrote in
message ...

I am trying to find out what a particular macro does as it's not
behaving the way I would expect it to. How do I run it in "step Mode"
so I can see what each step is doing?

Sarah


--
Sarahds


------------------------------------------------------------------------
Sarahds's Profile:

http://www.excelforum.com/member.php...o&userid=37005
View this thread: http://www.excelforum.com/showthread...hreadid=567313