Results 1 to 4 of 4

Thread: [RESOLVED] *mf* Vb

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jul 2005
    Posts
    236

    Resolved [RESOLVED] *mf* Vb

    Again - a problem. VB says: "Loop without Do". I could choke the man who invented VB.

    Sub Macro2()
    '
    ' Macro2 Macro
    ' Macro recorded 15-07-2005 by Anders Andersen
    '
    Dim Celle As Long
    Dim A As Long
    Dim B As Long
    Dim C As Long
    Dim D As Long
    Dim E As Long
    Dim XL As Variant
    Dim xlWS As Variant

    Set xlWS = ActiveSheet
    Dim colXLparams As New Collection
    Celle = 2
    A = 2
    B = 2
    C = 2
    D = 2
    E = 2

    Do While xlWS.Cells(A, 30).Value <> ""

    If Cells(E, 138).Value = "E" And Cells(D, 111).Value = "" Then
    Cells(Celle, 28).Value = "E"
    Exit Sub
    Else
    Cells(Celle, 28).Value = ""

    If Cells(D, 111).Value = "D" And Cells(C, 84).Value = "" Then
    Cells(Celle, 28).Value = "D"
    Exit Sub
    Else
    Cells(Celle, 28).Value = ""

    If Cells(C, 84).Value = "C" And Cells(B, 57).Value = "" Then
    Cells(Celle, 28).Value = "C"
    Exit Sub
    Else
    Cells(Celle, 28).Value = ""

    If Cells(B, 57).Value = "B" And Cells(A, 30).Value = "" Then
    Cells(Celle, 28).Value = "B"
    Exit Sub
    Else
    Cells(Celle, 28).Value = ""

    If Cells(A, 30).Value = "A" Then
    Cells(Celle, 28).Value = "A"
    Exit Sub
    Else
    Cells(Celle, 28).Value = ""
    End If

    Celle = Celle + 1
    A = A + 1
    B = B + 1
    C = C + 1
    D = D + 1
    E = E + 1

    Loop
    End Sub

  2. #2
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950

    Re: *mf* Vb

    Try replacing the exit sub statements with exit loop.
    Tengo mas preguntas que contestas

  3. #3
    Junior Member
    Join Date
    Jul 2005
    Posts
    20

    Re: *mf* Vb

    You need to add End If statements at the end of each If. There should be one End If for each If.

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Jul 2005
    Posts
    236

    Re: *mf* Vb

    Hi
    I solved it myself even before I checked your answers

Posting Permissions

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



Click Here to Expand Forum to Full Width