+ Reply to Thread
Results 1 to 7 of 7

Stepping through a Macro that acceots parameters

  1. #1
    Registered User
    Join Date
    03-15-2011
    Location
    Cottingham, England
    MS-Off Ver
    Excel 2003
    Posts
    28

    Stepping through a Macro that acceots parameters

    Hi all,
    I am having trouble with one of my macros and I want to step into it (usually F8) however, as it accepts parameters, it seems I can't do that. It is a worksheet change function:

    Please Login or Register  to view this content.
    Does anyone know how I can step through this line by line? It would be helpful so that I can see other debugging features held in the locals window etc

    Thanks

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,789

    Re: Stepping through a Macro that acceots parameters

    Slight correction, It is an worksheet change EVENT which occur if any change happens in that sheet.

    Just place the cursor in the next line of the code and press F8 which will add breaking point. Return to that sheet on which the code lies and just press a delete button on any of that sheet cell. Now the event will trigger.


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Registered User
    Join Date
    03-15-2011
    Location
    Cottingham, England
    MS-Off Ver
    Excel 2003
    Posts
    28

    Re: Stepping through a Macro that acceots parameters

    Thanks,
    It's been driving me mad!

  4. #4
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,789

    Re: Stepping through a Macro that acceots parameters

    Glad it helps you and thanks for the feedback and rep

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    49,791

    Re: Stepping through a Macro that acceots parameters

    Two other options:

    1. click in the grey border to the left of the code. You'll get a big red dot which indicates a break point on that line of code.
    2. put "Stop" without quotes as the first line of code in the event. The code will stop/break there and you can use F8 to step through from there.

    In either case, it doesn't have to be the first line of code, just where you want to trace from. However, it often makes sense to trace from the beginning as the error might have occurred before you think it does.


    Regards, TMS
    Last edited by TMS; 08-09-2013 at 07:21 AM. Reason: big not bug ;)
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  6. #6
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,239

    Re: Stepping through a Macro that acceots parameters

    @sixthsense, if you want to get really technical, they aren't Events, they are Event handlers - worksheet_change is just a sub that is called when the change Event of the worksheet fires.

  7. #7
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,789

    Re: Stepping through a Macro that acceots parameters

    @ Kyle123,

    Thanks for the correction I am not an expert in VBA just sharing what I know...

    So corrections are always welcome

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 4
    Last Post: 07-15-2013, 02:43 AM
  2. OpenText function in macro hangs unless stepping through code in debug
    By Part-Time Coder in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-06-2009, 05:32 PM
  3. [SOLVED] Macro Stepping
    By George in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-23-2006, 04:35 AM
  4. Excel Macro call Word Macro with Parameters
    By Bill Sturdevant in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 08-25-2005, 01:05 PM
  5. assigning parameters to a macro
    By Harvey in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-18-2005, 04:16 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1