Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default How to detect when a named cell (range) is Blank in VBA?

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default How to detect when a named cell (range) is Blank in VBA?

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"
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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default How to detect when a named cell (range) is Blank in VBA?

ok that Application.CountA(Range("MyNamedRange") worked for all named
cells! (ranges or not)

Gosh that seems so simple...!

THANK YOU very much!
Richard

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default How to detect when a named cell (range) is Blank in VBA?

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
--
The major part of getting the right answer lies in asking the right
question...


"Richard" wrote:

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



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
Average Formula to display blank cell if named range is blank Rachael F Excel Worksheet Functions 3 February 22nd 08 05:05 PM
Detect non-blank range Connie Excel Discussion (Misc queries) 2 October 16th 06 08:36 PM
Dynamic Named Range with blank cells tjtjjtjt Excel Discussion (Misc queries) 3 October 5th 05 08:10 PM
Detect if a selected cell is within a named range CraigB Excel Programming 2 November 25th 04 03:44 PM
Hiding Blank lines in named range Carl Brehm Excel Programming 3 August 8th 03 05:17 PM


All times are GMT +1. The time now is 08:01 PM.

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

About Us

"It's about Microsoft Excel"