Do Until Loop Not Working

G

Guest

When I try to compile the code below, I get a 'Loop without Do' error. The
code is designed to loop through an array and hide the rows that have a zero
value.

Thoughts?
Using Excel 2003.


Sub HideRow()

Range("B15").Select

Do Until ActiveCell = "STOP"
If ActiveCell.Value = 0 Then
ActiveCell.EntireRow.Hidden = True
ActiveCell.Offset(1, 0).Select
Else
ActiveCell.Offset(1, 0).Select
Loop

End Sub
 
J

JE McGimpsey

PJFry said:
When I try to compile the code below, I get a 'Loop without Do' error. The
code is designed to loop through an array and hide the rows that have a zero
value.

Thoughts?

You need an

End If

before the

Loop

statement.
 
G

Guest

Sub HideRow()

Range("B15").Select

Do Until ActiveCell = "STOP"
If ActiveCell.Value = 0 Then
ActiveCell.EntireRow.Hidden = True
ActiveCell.Offset(1, 0).Select
Else
ActiveCell.Offset(1, 0).Select
End if
Loop

End Sub
 

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