Combi If Then Do Loop werkt niet

Status
Niet open voor verdere reacties.

Minkoeze

Gebruiker
Lid geworden
5 okt 2005
Berichten
26
Hallo,

Ik probeer in een If Then een loop te zetten, maar ik krijg telkens de melding dat er een else is zonder if. Wat doe ik niet goed.

dit is de code

If Cells(i + p, 1) = "" _
Then IntContract = InputBox("Wat is het contractnummer?") _

Do While strPolis <> ""
Cells(i + p, 1) = IntContract
i = i + 1
strPolis = ActiveSheet.Cells(p + i, 4).Value
Loop
Else
End
End If
 
Code:
If Cells(i + p, 1) = "" Then
  IntContract = InputBox("Wat is het contractnummer?")

Do While strPolis <> ""
Cells(i + p, 1) = IntContract
i = i + 1
strPolis = ActiveSheet.Cells(p + i, 4).Value
Loop
Else
End

End If
 
Minkoeze,

De volgende keer moet je de code selecteren en dan op het # klikken, dan staat de code tussen tags.
Haal die Else eens weg.
 
Of gebruik de one-liner:

Code:
If Cells(i + p, 1) = "" then range(cells(i+p,4),cells(i+p,4).end(xldown)).offset(,-3)=InputBox("Wat is het contractnummer?")
 
Status
Niet open voor verdere reacties.
Steun Ons

Nieuwste berichten

Terug
Bovenaan Onderaan