What code do I use to test a cell for its content? I want to know if the cell is empty or contains text or values. Is "" produced by a formula the same as Blank or empty?
Thanks!!
What code do I use to test a cell for its content? I want to know if the cell is empty or contains text or values. Is "" produced by a formula the same as Blank or empty?
Thanks!!
Nope, a cell that contains a formula that returns "" isn't empty--it has that
formula in it:
You can check:
With ActiveSheet
.Range("a1").Formula = "="""""
'then try
'.range("a1").clearcontents
MsgBox IsEmpty(.Range("a1")) & vbLf & _
CBool(.Range("a1").Value = "") & vbLf & _
CBool(Trim(.Range("a1").Value = ""))
End With
And just to muddy the waters...A cell that had a formula that returned "" and
was converted to values isn't empty, either!
Brian Matlack wrote:
>
> What code do I use to test a cell for its content? I want to know if the
> cell is empty or contains text or values. Is "" produced by a formula
> the same as Blank or empty?
> Thanks!!
>
> --
> Brian Matlack
> ------------------------------------------------------------------------
> Brian Matlack's Profile: http://www.excelforum.com/member.php...fo&userid=3508
> View this thread: http://www.excelforum.com/showthread...hreadid=479098
--
Dave Peterson
if isempty(activeCell) then
' its empty
You can also look at Vartype
--
Regards,
Tom Ogilvy
"Brian Matlack" <[email protected]>
wrote in message
news:[email protected]...
>
> What code do I use to test a cell for its content? I want to know if the
> cell is empty or contains text or values. Is "" produced by a formula
> the same as Blank or empty?
> Thanks!!
>
>
> --
> Brian Matlack
> ------------------------------------------------------------------------
> Brian Matlack's Profile:
http://www.excelforum.com/member.php...fo&userid=3508
> View this thread: http://www.excelforum.com/showthread...hreadid=479098
>
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks