DO Loops Syntax in VBA

Here MS Excel related topics will be posted.
Post Reply
admin
Posts: 2062
Joined: Fri Mar 31, 2006 12:59 am
Location: Pakistan
Contact:

DO Loops Syntax in VBA

Post by admin »

x = 1

Do While x < 10
Cells(x, 1).Value = x
x = x + 1
Loop

-- Based on a condition to check cell value

x = 5

Do While Cells(x, 1).Value <> ""
Cells(x, 3).Value = Cells(x, 2).Value + 30
x = x + 1
Loop

-- Do Until

intRow = 1

Do Until IsEmpty(Cells(intRow, 1))

Cells(intRow, 1).Value = "ERPstuff"
intRow = intRow + 1
Loop

intRow = 1

-- Do where Until after loopo so once it will must execute
Do
Cells(intRow, 1).Value = "Info"
intRow = intRow + 1
Loop Until IsEmpty(Cells(intRow, 1))
Malik Sikandar Hayat
admin@erpstuff.com
Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests