+ Reply to Thread
Results 1 to 2 of 2

Do...Loop not working

  1. #1
    Sunny Lin
    Guest

    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. #2
    keepITcool
    Guest

    Re: 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1