ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel VBA Step into (https://www.excelbanter.com/excel-programming/408201-excel-vba-step-into.html)

DaveM[_2_]

Excel VBA Step into
 
Hi

I have a large macro with 100's of lines of code, sometimes I need to run
half of the code. I stepin the macro then have to drag the yellow arrow
100's of lines down, Is the a way to start the code somewhere in the middle
without draging the arrow down all those lines. I've looked in Help &
Googled, Is there a way?

Thanks in advance

Dave



Jarek Kujawa[_2_]

Excel VBA Step into
 
divide the code into 2 parts/macros

cut the lower/2nd part into another macro, name it "part2" for
instance

in the 1st macro instead of the code that had been cut put:

Call part2

this will keep your 1st macro unchanged


and use the "part2" macro when needed



HIH



On 23 Mar, 22:42, "DaveM" wrote:
Hi

I have a large macro with 100's of lines of code, sometimes I need to run
half of the code. I stepin the macro then have to drag the yellow arrow
100's of lines down, Is the a way to start the code somewhere in the middle
without draging the arrow down all those lines. I've looked in Help &
Googled, Is there a way?

Thanks in advance

Dave



Jarek Kujawa[_2_]

Excel VBA Step into
 
forgot to mention that your variables have to be made public
;-(
sorry


On 23 Mar, 23:00, Jarek Kujawa wrote:
divide the code into 2 parts/macros

cut the lower/2nd part into another macro, name it "part2" for
instance

in the 1st macro instead of the code that had been cut put:

Call part2

this will keep your 1st macro unchanged

and use the "part2" macro when needed

HIH

On 23 Mar, 22:42, "DaveM" wrote:



Hi


I have a large macro with 100's of lines of code, sometimes I need to run
half of the code. I stepin the macro then have to drag the yellow arrow
100's of lines down, Is the a way to start the code somewhere in the middle
without draging the arrow down all those lines. I've looked in Help &
Googled, Is there a way?


Thanks in advance


Dave- Ukryj cytowany tekst -


- Pokaż cytowany tekst -



Mark Ivey[_2_]

Excel VBA Step into
 
Just a few thoughts...

Excel macros are sequential code. They have to execute in the sequence you
have set forth.

When I need to do what you are wanting to do, I single click the left pane
on the line of code just before the code line I want to step into. This
should put a maroon circle on the left side pane and highlight that line of
code in maroon as well. This sets a stop point for your macro. You can
launch the macro and it will stop at this point and wait for you to give it
further instructions (ie - continue to step through the remainder of your
code with "F8", or something like that).

Mark

"DaveM" wrote in message
...
Hi

I have a large macro with 100's of lines of code, sometimes I need to run
half of the code. I stepin the macro then have to drag the yellow arrow
100's of lines down, Is the a way to start the code somewhere in the
middle without draging the arrow down all those lines. I've looked in Help
& Googled, Is there a way?

Thanks in advance

Dave


Dick Kusleika[_4_]

Excel VBA Step into
 
On Sun, 23 Mar 2008 17:50:20 -0500, "Mark Ivey"
wrote:

Just a few thoughts...

Excel macros are sequential code. They have to execute in the sequence you
have set forth.

When I need to do what you are wanting to do, I single click the left pane
on the line of code just before the code line I want to step into. This
should put a maroon circle on the left side pane and highlight that line of
code in maroon as well. This sets a stop point for your macro. You can
launch the macro and it will stop at this point and wait for you to give it
further instructions (ie - continue to step through the remainder of your
code with "F8", or something like that).


That's how I do it too. You can also scroll down to the line you want
(while in break mode), right click, and choose Run to Cursor.
--
Dick Kusleika
Microsoft MVP-Excel
http://www.dailydoseofexcel.com

Bob Phillips

Excel VBA Step into
 
You can also add a Stop statement in there, it will then wait for you, or
even add a conditional Debug.Assert, so many ways.

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)



"Dick Kusleika" wrote in message
...
On Sun, 23 Mar 2008 17:50:20 -0500, "Mark Ivey"
wrote:

Just a few thoughts...

Excel macros are sequential code. They have to execute in the sequence you
have set forth.

When I need to do what you are wanting to do, I single click the left pane
on the line of code just before the code line I want to step into. This
should put a maroon circle on the left side pane and highlight that line
of
code in maroon as well. This sets a stop point for your macro. You can
launch the macro and it will stop at this point and wait for you to give
it
further instructions (ie - continue to step through the remainder of your
code with "F8", or something like that).


That's how I do it too. You can also scroll down to the line you want
(while in break mode), right click, and choose Run to Cursor.
--
Dick Kusleika
Microsoft MVP-Excel
http://www.dailydoseofexcel.com




DaveM[_2_]

Excel VBA Step into
 
Thank you all very much for your Help.

All is fine

DaveM


"Bob Phillips" wrote in message
...
You can also add a Stop statement in there, it will then wait for you, or
even add a conditional Debug.Assert, so many ways.

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my
addy)



"Dick Kusleika" wrote in message
...
On Sun, 23 Mar 2008 17:50:20 -0500, "Mark Ivey"
wrote:

Just a few thoughts...

Excel macros are sequential code. They have to execute in the sequence
you
have set forth.

When I need to do what you are wanting to do, I single click the left
pane
on the line of code just before the code line I want to step into. This
should put a maroon circle on the left side pane and highlight that line
of
code in maroon as well. This sets a stop point for your macro. You can
launch the macro and it will stop at this point and wait for you to give
it
further instructions (ie - continue to step through the remainder of your
code with "F8", or something like that).


That's how I do it too. You can also scroll down to the line you want
(while in break mode), right click, and choose Run to Cursor.
--
Dick Kusleika
Microsoft MVP-Excel
http://www.dailydoseofexcel.com







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

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