Do loops when to use them??

Alpacino

Well-known Member
Joined
Mar 16, 2011
Messages
511
Hi just a quick question. When do you use a do loop oe do until loops?? I use a few for next but never understand when you use do loops can someone explain or give an example of when to use them.

Thanks
 
Code:
Sub x()
    If 1 = 0 Then
        MsgBox "Surprise"
    ElseIf 1 = 1 Then
        MsgBox "No Surprise"
    Else
        MsgBox "Surprise"
    End If
End Sub
 
Upvote 0

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
My god, even at 35 I can be an idiot.

You realize I've been developing xls for 6 months working around not having an elseif because I wasn't using it right.....

Lemme just go kill myself right now... sorry folks. this old dog learned a new trick.
 
Upvote 0
I worked it out the cells had conditional formatting in them thats why it seemed like it didnt work. I removed the cond format and it worked!!!
 
Upvote 0

Forum statistics

Threads
1,224,587
Messages
6,179,733
Members
452,939
Latest member
WCrawford

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top