Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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 ***
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default 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 ***

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Loop all Sheets not working. Pank New Users to Excel 12 February 27th 07 11:55 AM
for next loop not working Tom Ogilvy Excel Programming 0 September 27th 04 05:36 PM
for next loop not working Ron Rosenfeld Excel Programming 0 September 25th 04 04:07 AM
Find value loop not working Christiane[_6_] Excel Programming 3 April 6th 04 01:53 AM
Loop - for each sheet not working? Shetty Excel Programming 6 January 15th 04 02:22 PM


All times are GMT +1. The time now is 09:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"