Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / January 2006

Tip: Looking for answers? Try searching our database.

How to detect when a named cell (range) is Blank in VBA?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Richard - 26 Jan 2006 04:46 GMT
I have named cells that are either single cells of ranges.
I need to detect, using VBA, is those named cells are empty or any
value, INCLUDING formulas that would (incidently) return "" !!

I've been scouring google for the answer to no avail :(

So to recap: How can I detect (a true/false is fine) if a named cell
(which can be a range/single cell) is Blank AND it does NOT contain any
formulas (it happends that some Named Cells 'arrays' have formulas that
return "" )

Many thanks for your help!

Richard
Jim Cone - 26 Jan 2006 05:34 GMT
Richard,

For an entire range you can use... Application.CountA(Range("MyNamedRange")
For a single cell...
   The Len function is very fast... x = Len(ActiveCell)
   (however, a single apostrophe ' in a cell is not counted)
   x = IsEmpty(ActiveCell) seems to be the choice of many.

Regards,
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware

"Richard" <richard.taillon@gmail.com>
wrote in message
I have named cells that are either single cells of ranges.
I need to detect, using VBA, is those named cells are empty or any
value, INCLUDING formulas that would (incidently) return "" !!
I've been scouring google for the answer to no avail :(
So to recap: How can I detect (a true/false is fine) if a named cell
(which can be a range/single cell) is Blank AND it does NOT contain any
formulas (it happends that some Named Cells 'arrays' have formulas that
return "" )
Many thanks for your help!
Richard
Richard - 26 Jan 2006 17:27 GMT
ok that Application.CountA(Range("MyNamedRange") worked for all named
cells! (ranges or not)

Gosh that seems so simple...!

THANK YOU very much!
Richard
John Skewes - 26 Jan 2006 08:37 GMT
Hi Richard,

Have you tried SpecialCells? e.g. (this returns the addresses of blank cells)
Sub WotAboutThis()
     MsgBox Cells.SpecialCells(xlCellTypeBlanks).Address(0, 0)
End Sub
Signature

The major part of getting the right answer lies in asking the right
question...

> I have named cells that are either single cells of ranges.
> I need to detect, using VBA, is those named cells are empty or any
[quoted text clipped - 10 lines]
>
> Richard
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.