Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loop without Do error

Status
Not open for further replies.
Nov 16, 2006
19
GB
Good afternoon,

When running the following code i get a Compile Error "Loop without Do".

Have also tried it with a For - Next loop but similar results.

Any ideas?

there are no other do's or loop's within the module

Code:
y = 8

Do
    y = y + 1
    
    If dots >= 5 Then
        dots = 0
        str_Running = str_Run
    Else
        dots = dots + 1
        str_Running = str_Running & "."
    End If

    Sheet1.Cells(3, 6) = str_Running

    If ActiveSheet.Cells(y, 147) > 0 Then
        agnt_num = ActiveSheet.Cells(y, 5)

        Do
            scanY = scanY + 3
        Loop Until Sheet2.Cells(scanY, 3) = agnt_num Or Sheet2.Cells(scanY, 3) = ""

        If Sheet2.Cells(scanY, 3) = "" Then
            Sheet2.Cells(scanY, 3) = agnt_num
            Sheet2.Cells(scanY, 2) = ActiveSheet.Cells(y, 5)
        End If

        reg_hour = 63

        For x = 10 To 43

            cell1 = ActiveSheet.Cells(y, reg_hour)

            Select Case cell1

            Case "S"
                cell1 = 1
            Case "E"
                cell1 = 1
            Case "1"
                cell1 = 1
            Case "OS"
                cell1 = 1
            Case "OE"
                cell1 = 1
            Case "O"
                cell1 = 1
            Case "SS"
                cell1 = 1
            Case "SE"
                cell1 = 1
            Case Else
                cell1 = 0
            End Select

            cell1 = ActiveSheet.Cells(y, reg_hour + 1)

            Select Case cell2

            Case "S"
                cell2 = 1
            Case "E"
                cell2 = 1
            Case "1"
                cell2 = 1
            Case "OS"
                cell2 = 1
            Case "OE"
                cell2 = 1
            Case "O"
                cell2 = 1
            Case "SS"
                cell2 = 1
            Case "SE"
                cell2 = 1
            Case Else
                cell2 = 0
            End Select

            cell0 = (cell1 + cell2) / 2

            Sheet2.Cells(scanY + 1, x) = cell0

            Sheet2.Cells(scanY + 2, x).FormulaR1C1 = "=R[-2]C-R[-1]C"

            reg_hour = reg_hour + 2

        Next x
 
Loop Until y = 300
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top