Looper Blooper

S

stendahl_jones

I had a loop that worked just fine. Then I added an extra IF-Else and the
computer started complianing that I had loop without do, which is untrue. Can
anyone see whats wrong with this loop?

If rng1 Is Nothing Then
MsgBox ("Datum (date) kan ej hittas!")
Else
i = 0
Do Until IsEmpty(rng1.Offset(i + 1, 0)) = True
If rng1.Offset(i + 1, 0).Text = startDatumArr(1) Then
strTeststartDatumAddress = rng1.Offset(i + 1, 0).Address
i = i + 1
Else
i = i + 1
If rng1.Offset(i + 1, 0).Text = slutDatumArr(1) Then
strTestslutDatumAddress = rng1.Offset(i + 1, 0).Address
Else: End If
Loop
End If

Thank you for your time.
 
N

Norman Jones

Hi Stendahl,

Try:

If Rng1 Is Nothing Then
MsgBox ("Datum (date) kan ej hittas!")
Else
i = 0
Do Until IsEmpty(Rng1.Offset(i + 1, 0)) = True
If Rng1.Offset(i + 1, 0).Text = startDatumArr(1) Then
strTeststartDatumAddress = _
Rng1.Offset(i + 1, 0).Address
i = i + 1
Else
i = i + 1
If Rng1.Offset(i + 1, 0).Text = slutDatumArr(1) Then
strTestslutDatumAddress = _
Rng1.Offset(i + 1, 0).Address
Else
End If
End If
Loop
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top