PDA

View Full Version : loops and IsEmpty



lexluther88
12-02-2006, 10:01 AM
Hey, I'm trying to use a Do while loop to do the following:

" Before the loop begins, initialize the current instruction line variable to the top row of instructions (4). The condition of the loop should check if the current row of instructions has something in column 1, column 2, or column 3. (i.e. there is text in the current row)"


Using, something like this format...

Do
Until IsEmpty(______) And IsEmpty( ) And Is Empty(_________)

I've tried the following code, but get a syntax error. How can I run my loop using IsEmpty, to make sure there are things in my cells, pertaining to my 3 condtions, drawColor, dimDistance and drawDirection?

Dim drawColor as string
Dim drawDistance integer
Dim drawDirection as string

Do

Until isEmpty(drawColor) And isEmpty(drawDistance) And isEmpty(drawDirection)

loop




Hmm, maybe they dont want me to use my 3 variables..just check to make sure that column 1, 2 and 3 aren't empty? How would I check that?

mdmackillop
12-02-2006, 10:24 AM
Try something like:

Sub Test3Cols()
Dim rw as long
Do
rw = rw + 1
Cells(rw, 4) = "x"
Loop Until Application.WorksheetFunction.CountBlank(Cells(rw, 1).Resize(, 3)) = 3
End Sub

Bob Phillips
12-02-2006, 11:12 AM
Dim drawColor As String
Dim drawDistance As Integer
Dim drawDirection As String

Do Until drawColor = "" And drawDistance = 0 And drawDirection = ""

Loop