statement to Exit Do if empty row
Norman,
Thanks for you help. Following is the code that I used to test the
statement:
Option Compare Text
Sub empty_row()
' empty_row Macro
Range("A1").Select ' set up a short
test
ActiveCell.Value = "a" ' with an a in
cell A1
ActiveCell.Offset(1, 1).Value = "b" ' and a b in
cell Bb2
ActiveCell.Offset(2, 2).Value = "c" ' and a c in
cell C3
Do While Application.CountA(ActiveCell.EntireRow) 0
ActiveCell.Offset(0, 5).Value =
Application.CountA(ActiveCell.EntireRow) ' put the count in col F
ActiveCell.Offset(1, 0).Select ' move down to
the next row
i = i + 1 ' increment an
internal counter
response = MsgBox(i, 48, "Count") ' display a
MsgBox to watch the count
If i = 5 Then Exit Do ' prevent going
too far
Loop
ActiveCell.Offset(0, 5).Value =
Application.CountA(ActiveCell.EntireRow) ' this count should be 0
End Sub
--
Mike Mannix
"Norman Jones" wrote in message
...
Hi Mike,
Try something like:
If Application.CountA (ActiveCell.EntireRow) = 0 Then Exit Do
or
If Application.CountA (rows(10)) = 0 Then Exit Do
---
Regards,
Norman
"Mike" wrote in message
...
How do I code the statement in an Excel2000 macro to Exit Do if the
entire
row is empty?
ie: If "empty row" then Exit Do
Thanks, Mike
|