ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Do...Loop not working (https://www.excelbanter.com/excel-programming/327402-do-loop-not-working.html)

Sunny Lin

Do...Loop not working
 
I'm frustrated! My code is so simple, but for some reason (which I know
I missed) is not running. It's a simple Do...Loop Until statement.
Inside the loop are just if...then conditionals. However, when I run
it, I get an error stating that there is a loop without a do. Here is a
part of the code:

Do
If Me.Cells((i - c) + j, 3) = 3 Then
If (DateDiff("n", date1, date2)) / 60 0.3
Then
cumtime = cumtime + (DateDiff("n", date1, date2)) / 60
End
End
j = j + 1
Loop Until DateDiff("d", date1, date2) = 1

Looks pretty straightforward to me. Why am I getting the error
message?? Any help would be greatly appreciated. Thanks.

Sunny

*** Sent via Developersdex http://www.developersdex.com ***

keepITcool

Do...Loop not working
 

s/b

IF
...
end IF

instead of

if
...
end


end by itself is something entirely different..



--
keepITcool
| www.XLsupport.com | keepITcool chello nl | amsterdam


Sunny Lin wrote :

I'm frustrated! My code is so simple, but for some reason (which I
know I missed) is not running. It's a simple Do...Loop Until
statement. Inside the loop are just if...then conditionals.
However, when I run it, I get an error stating that there is a loop
without a do. Here is a part of the code:

Do
If Me.Cells((i - c) + j, 3) = 3 Then
If (DateDiff("n", date1, date2)) / 60 0.3
Then
cumtime = cumtime + (DateDiff("n", date1, date2)) / 60
End
End
j = j + 1
Loop Until DateDiff("d", date1, date2) = 1

Looks pretty straightforward to me. Why am I getting the error
message?? Any help would be greatly appreciated. Thanks.

Sunny

*** Sent via Developersdex http://www.developersdex.com ***



All times are GMT +1. The time now is 10:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com