+ Reply to Thread
Results 1 to 8 of 8

Repeat Macro until desired result

  1. #1
    Forum Contributor
    Join Date
    12-16-2004
    Posts
    125

    Repeat Macro until desired result

    Hello,

    I have a simple copy and paste macro that I want to repeat until a formula in cell AR3 says "YES". Does anyone know what I need to add to my macro to do this?

    Thanks for any help.

  2. #2
    Forum Expert
    Join Date
    12-29-2004
    Location
    Michigan, USA
    MS-Off Ver
    2013
    Posts
    2,208

    Re: Repeat Macro until desired result

    Try something like:

    Please Login or Register  to view this content.
    HTH,
    Jason

  3. #3
    Forum Contributor
    Join Date
    12-16-2004
    Posts
    125

    Re: Repeat Macro until desired result

    Thanks Jason,

    That works, but now I'm wondering if there is a way to have it repeat until AR3 = "YES" or up to 10 times. Just in case a yes does not come quickly I don't want it to run forever. Any suggestions?

  4. #4
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Repeat Macro until desired result

    Try this:

    Please Login or Register  to view this content.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

  5. #5
    Forum Contributor
    Join Date
    12-16-2004
    Posts
    125

    Re: Repeat Macro until desired result

    Thanks JBeaucaire, but that gives me a "Loop without do error." Any suggestions how to avoid this error?

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: Repeat Macro until desired result

    JB, you can't have criteria in both the Do and the Loop. It's either

    Do [{While | Until} condition] / Loop

    or

    Do / Loop [{While | Until} condition]
    Entia non sunt multiplicanda sine necessitate

  7. #7
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Repeat Macro until desired result

    Yeah, my bad, wishful thinking, same idea but inside the loop:

    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    12-16-2004
    Posts
    125

    Re: Repeat Macro until desired result

    Thanks JBeaucaire, but everything worked but the stopping after 10 part.

+ 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