|
-
Jul 15th, 2005, 03:10 AM
#1
Thread Starter
Addicted Member
[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
-
Jul 15th, 2005, 06:32 AM
#2
Frenzied Member
Re: *mf* Vb
Try replacing the exit sub statements with exit loop.
Tengo mas preguntas que contestas
-
Jul 15th, 2005, 06:48 AM
#3
Junior Member
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.
-
Jul 15th, 2005, 06:53 AM
#4
Thread Starter
Addicted Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|