As the help for COUNTA indicates, it will count any *non empty* cell. XL
defines a non-empty cell as one that contains anything in it including a
formula that makes it *appear* that the cell is empty (as in your case).
If all the cells in I28:I950 contain the formula you mention, use
COUNTIF(E1:F10,"") This will count cells that are either truly empty or
appear empty because of a formula yields "".
Just for the record COUNTIF(E1:F10,"=") will count cells that are truly
empty. Don't ask me why.
"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" <tmUnderscore200310@tushar-mehta.SeeOhEm> wrote in message
> news:7118C344-C0EB-4606-9E83-4D9CEE4C09AD@microsoft.com...
> > 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
> >>
> >>
> >>
>
>
>
Bookmarks