Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default statement to Exit Do if empty row

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default statement to Exit Do if empty row

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




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default statement to Exit Do if empty row

Hi mike

If Application.CountA(Rows(rownumber)) = 0 Then

--
Regards Ron de Bruin
http://www.rondebruin.nl


"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




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
I need an If statement for Excel that excludes empty cells nascar2000a Excel Worksheet Functions 3 November 9th 06 04:30 PM
if statement where cell is not empty mattguerilla Excel Discussion (Misc queries) 6 October 1st 06 07:31 PM
if statement for empty cell CORY Excel Discussion (Misc queries) 1 February 3rd 06 06:25 PM
if statement for empty cell CLR Excel Discussion (Misc queries) 0 February 3rd 06 06:03 PM
is statement with an empty cell as result RDM Excel Worksheet Functions 4 March 2nd 05 04:18 PM


All times are GMT +1. The time now is 06:24 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"