+ Reply to Thread
Results 1 to 3 of 3

Empty cell Identified

  1. #1
    Forum Contributor
    Join Date
    12-04-2003
    Location
    Burrton, Kansas USA
    MS-Off Ver
    2003
    Posts
    162

    Empty cell Identified

    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!!

  2. #2
    Dave Peterson
    Guest

    Re: Empty cell Identified

    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

  3. #3
    Tom Ogilvy
    Guest

    Re: Empty cell Identified

    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
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1