+ Reply to Thread
Results 1 to 11 of 11

Pausing Macro

Hybrid View

  1. #1
    Registered User
    Join Date
    03-23-2007
    Posts
    91

    Pausing Macro

    Hi

    Is there a way to pause a macro while it is running?
    For example:

    COL A COL B
    1 2
    b 4
    5 5

    My current macro highlights all characters in this case b.
    Is there a way to make it stop when it highlights b, and make it continue running when I want? I'm using a Form for this purpose.

    Thanks

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello Dohko,

    Place a MsgBox in your macro code at the point it finishes highlighting the data.
    MsgBox "Click OK to continue."
    Sincerely,
    Leith Ross

  3. #3
    Registered User
    Join Date
    03-23-2007
    Posts
    91
    Yes, I tried that. But I need to play with the data before I can continue running the program.
    MsgBox won't let me touch the spreadsheet unless I click yes or no. or close it.

  4. #4
    Forum Expert dominicb's Avatar
    Join Date
    01-25-2005
    Location
    Lancashire, England
    MS-Off Ver
    MS Office 2000, 2003, 2007 & 2016 365
    Posts
    4,867

    Smile

    Good afternoon Dohko

    So why not split your code into two macros?

    HTH

    DominicB
    Please familiarise yourself with the rules before posting. You can find them here.

  5. #5
    Registered User
    Join Date
    03-23-2007
    Posts
    91
    Actually it's 2 macros.
    The actual situation is this.
    I have a macro that colors cells that have errors.
    I want to be able to modify them and then continue running the macro.
    Like for example I fixed one cell and then just press continue or something like that

  6. #6
    Forum Contributor
    Join Date
    01-21-2005
    Location
    Colorado
    MS-Off Ver
    2000,2003,2007
    Posts
    481
    There are several things you could do depending on the complexity of your macro code.

    -When the error is found you could have the code open an input box which
    would prompt for the correct information then overwrite the errenous cell
    with the correction. The code would be 'paused' until a value is entered into
    the input box. This would also allow you to check the value entered into the
    input box before continuing.

    -You could open a modeless userform which alerts the user to the errenous
    cell and will allow them to interact with the spreadsheet while the userform is
    open. Then when the correction is made they can click 'Continue' or
    whatever button you choose on the userform.

    -If your code and data being checked is relatively small you could highlight
    the errenous cell and simply have the code end. Then recheck all data from
    the beginning with the new correction in place and if your code or data isn't
    extreemly large then the user won't see any significant difference in
    execution time.

    HTH

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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