Results 1 to 5 of 5

vba step into code

This is a discussion on vba step into code within the Excel Questions forums, part of the Question Forums category; Is there a way to step into the procedure at a certain point, or alternatively to skip to the end ...

  1. #1
    Board Regular
    Join Date
    Mar 2011
    Posts
    665

    Default vba step into code

    Is there a way to step into the procedure at a certain point, or alternatively to skip to the end of a loop.

    It's really frustrating having to go through certain loops (ones which go through over 100 times) just to get to the bit of code I'm interested in seeing.

  2. #2
    Board Regular
    Join Date
    Jul 2002
    Location
    Milton Keynes, England
    Posts
    10,945

    Default Re: vba step into code

    You can set breakpoints ( click at left of code so as to turn row maroon ), or just select the row of code you want to examine and choose Run To Cursor ( Ctrl+F8 ).
    Cheers, Glenn.

    Beauty is in the eye of the beer-holder.

  3. #3
    Board Regular
    Join Date
    Mar 2011
    Posts
    665

    Default Re: vba step into code

    ah ok, thanks Glenn

  4. #4
    Board Regular villy's Avatar
    Join Date
    May 2011
    Posts
    489

    Default Re: vba step into code

    you can add some code to step into..
    for example I have 50 times loops and I want only to know the value between 25 and 30 I will add condition.
    [code]
    ...
    for i=2 to 50
    while (i >= 25 and i <= 30) ' condition to perform only between 25 to 30
    ...do your code
    wend
    next i
    I am using Office 2003 @ Work & 2007 @ Home
    P-assionate love for GOD
    L-ove and compassion to others
    I-ntegrity
    F-aithfulness
    EXCELence
    "To a man it is impossible but with God everything is possible."

  5. #5
    Board Regular
    Join Date
    Jul 2002
    Location
    Milton Keynes, England
    Posts
    10,945

    Default Re: vba step into code

    Quote Originally Posted by villy View Post
    you can add some code to step into..
    for example I have 50 times loops and I want only to know the value between 25 and 30 I will add condition.
    [code]
    ...
    for i=2 to 50
    while (i >= 25 and i <= 30) ' condition to perform only between 25 to 30
    ...do your code
    wend
    next i
    I would never do that when you can add watches to trigger under any specific condition. ( Debug Add Watch, or right click any variable or calculation and choose Add Watch ... you can set a clause like i=30 and choose to break when clause is True )
    Cheers, Glenn.

    Beauty is in the eye of the beer-holder.

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


DMCA.com