Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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!!


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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Empty cell Identified

if isempty(activeCell) then
' its empty


You can also look at Vartype

--
Regards,
Tom Ogilvy


"Brian Matlack"
wrote in message
news:Brian.Matlack.1xgo6g_1130249129.0561@excelfor um-nospam.com...

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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to compare worksheets so differences are identified Debilin Excel Worksheet Functions 1 July 9th 09 02:21 PM
Each client to be identified into segment Mat Excel Discussion (Misc queries) 2 March 15th 07 03:59 PM
why a reference to an empty cell is not considered empty Nicoscot Excel Discussion (Misc queries) 10 March 10th 06 05:36 AM
can a cell be identified as a drop down box without moving the cur stumakker Excel Discussion (Misc queries) 1 January 13th 06 03:44 PM
Removing Lines Identified by Autofilter Neil[_6_] Excel Programming 2 July 10th 03 04:58 AM


All times are GMT +1. The time now is 06:19 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"