View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson[_5_] Dave Peterson[_5_] is offline
external usenet poster
 
Posts: 1,758
Default Code is not correct

=counta() includes all formulas--including those that evaluate to "".

Maybe you could use a different formula:

If Application.CountIf(Range("I28:I950"), """") 0 Then

(I like application.countif, but you could still use worksheetfunction.countif.)

Pat wrote:

The messagebox appears even though there is no data in I28:I950
For some reason it thinks there is data in the range, only the formula as
mentioned will be in the range.

"Tushar Mehta" wrote in message
...
What do you want it to do?

"Pat" wrote:

The following code is not correct.


If WorksheetFunction.CountA(Range("I28:I950")) 0 Then
If Cells(21, 11).Value = "QS" Then
MsgBox "There is data in column I28:I950, find and delete
this
data. You cannot have any data in the Quantity Ordered column when you
are
creating a Quick Sale invoice. "
Exit Sub
End If
End If


There is a formula in cell in the range I28:I950
For eg. =IF(J76="","",J76)


I will appreciate any and all help.

Thanks
Pat




--

Dave Peterson