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.
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.
Try something like:
HTH,Do Until Range("AR3") = "YES" . . . your code Loop
Jason
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?
Try this:
Dim Cnt as Long Do Until Range("AR3") = "YES" 'your code Cnt = Cnt + 1 Loop While Cnt < 11
_________________
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!)
Thanks JBeaucaire, but that gives me a "Loop without do error." Any suggestions how to avoid this error?
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
Yeah, my bad, wishful thinking, same idea but inside the loop:
Dim Cnt as Long Do Until Range("AR3") = "YES" 'your code If Cnt = 10 Then Exit Do Else Cnt = Cnt + 1 Loop
Thanks JBeaucaire, but everything worked but the stopping after 10 part.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks