"Rick Rothstein (MVP -
VB)" wrote in
message ...
I'm assuming you are the Jeff Johnson I know from over in the compiled VB
newsgroups, right? What are you doing here... did you get lost?<g
I'm stunned at how active this group is! I no longer feel bad for directing
people here; I used to think this place was kind of dead.
The ISBLANK function only returns TRUE for a fully empty cell (it returns
FALSE if nothing is displayed as a result of a formula). If that is the
functionality you want in your VBA code, I think this function below will
work for you (just pass in a Range reference for the cell you are
testing)...
Function IsCellBlank(MyCell As Range) As Boolean
IsCellBlank = (MyCell.Value = "") And (MyCell.Formula = "")
End Function
Notice, it is a one-liner.<bg
As expected!
The point is that the cell really is empty, but on workbook load, Excel
doesn't think so. As stated, if I simply double-click on it (or press F2)
and then hit Enter without doing anything else, Excel will "realize" that
the cell is empty. In other words, if A1 is one of these cells and I put
"=ISBLANK(A1)" into B1, B1 will display FALSE at first, but if I do the
"null edit" thing I just mentioned B1 will now show TRUE.
The Len() function, as mentioned by another poster, won't help, because as
far as VBA code is concerned, the Value of the cell is "". But ISBLANK()
definitely "knows" the cell isn't blank, or more specifically, it knows that
the COUNTA() function won't consider it blank. But since I can't use it in
code, I'm kind of stumped....