# Thread: if..then statement within a loop

1. Registered User
Join Date
Feb 2004
Posts
45

## Unanswered: if..then statement within a loop

hallo,
I have this code:

k = 1
g = 4

Do Until rs3.EOF
uRow3 = rs3(i3 + 3)
If Sht.Cells(k, g).Value = uRow3 Then
Sht.Cells(k, g).Value = rs3(i3 + 4)
rs3.MoveNext
Else
k = k + 1
Loop

But it doesn't work: debugger tells me that there is a loop without a do. Do you have an idea?

2. Registered User
Join Date
Sep 2002
Location
South Wales
Posts
580
Do Until rs3.EOF

uRow3 = rs3(i3 + 3)

If Sht.Cells(k, g).Value = uRow3 Then

Sht.Cells(k, g).Value = rs3(i3 + 4)

rs3.MoveNext

Else

k = k + 1

End if '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Loop

3. Registered User
Join Date
Feb 2004
Posts
45
aaaaaaaaaahhhhhhhhh

thanks

4. Grand Poobah
Join Date
Sep 2003
Location
MI
Posts
3,713
Originally posted by garethdart
Do Until rs3.EOF

uRow3 = rs3(i3 + 3)

If Sht.Cells(k, g).Value = uRow3 Then

Sht.Cells(k, g).Value = rs3(i3 + 4)

rs3.MoveNext

Else

k = k + 1

End if '!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Loop
This isn't "C" you know ...

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•