View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Count rows On error MsgBox

Hi Robert,

here is some code

Sub AnyBlanks()

If
Application.Evaluate("MAX((A1:A1000<"""")*ROW(A1: A1000))-COUNTA(A:A)") < 0
Then
MsgBox "There are empty cells"
End If

End Sub


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Robert Christie" wrote in message
...
Hi
I need some lines of code to count the number of rows in
column A which includes blank cells.
If number of rows is greater than, less than 10 a MsgBox
with instructions should appear.
I'm importing a .txt file, deleting any blank rows and
adding/changing text and some formatting. When finished
the text should finish on row 10, ranging from cell A1 to
N10 no-more no-less.
The purpose is to indicate to the user, the original .txt
file did not contain 10 rows of text.
These lines of code will run at the end of macro.

I'm not sure how the Count, If true, if false, then, else
syntax should be laid out, and call up the MsgBox.

TIA

Bob C.