Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
dan dan is offline
external usenet poster
 
Posts: 38
Default Test if the range is empty

I need a VBA code to ensure the range to be filled, is empty to begin.
I will select the range, test if the range is empty, then proceed
accordingly.
Thanks


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,290
Default Test if the range is empty


Application.CountA(rngToBeFilled)
(you don't need to select the range)
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"dan"
wrote in message
I need a VBA code to ensure the range to be filled, is empty to begin.
I will select the range, test if the range is empty, then proceed
accordingly.
Thanks


  #3   Report Post  
Posted to microsoft.public.excel.misc
dan dan is offline
external usenet poster
 
Posts: 38
Default Test if the range is empty

Thank you, Jim
Nice trick.

"Jim Cone" wrote in message
...

Application.CountA(rngToBeFilled)
(you don't need to select the range)
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"dan"
wrote in message
I need a VBA code to ensure the range to be filled, is empty to begin.
I will select the range, test if the range is empty, then proceed
accordingly.
Thanks




  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 422
Default Test if the range is empty

Jim - I opened a new workbook - made no entries into sheet1 (the
activesheet)..

From the immediate Window I entered:
set rng = Activesheet.Range("G1:G5")
? rng.address
$G$1:$G$5
? isempty(rng)
FALSE << WHY???

TIA,
Jim


"Jim Cone" wrote in message
:

Application.CountA(rngToBeFilled)
(you don't need to select the range)
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"dan"
wrote in message
I need a VBA code to ensure the range to be filled, is empty to begin.
I will select the range, test if the range is empty, then proceed
accordingly.
Thanks


  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,290
Default Test if the range is empty

I would say you are asking it to do something beyond its
design specs. I can't give you the technical explanation,
but the help file says IsEmpty only works on Variant variables.
The fact that it works on single cells is just a nice bonus.
For what it's worth, I usually use Len to check a single cell.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"JMay"
wrote in message
Jim - I opened a new workbook - made no entries into sheet1 (the
activesheet)..

From the immediate Window I entered:
set rng = Activesheet.Range("G1:G5")
? rng.address
$G$1:$G$5
? isempty(rng)
FALSE << WHY???
TIA,
Jim


"Jim Cone"
wrote in message

Application.CountA(rngToBeFilled)
(you don't need to select the range)
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"dan"
wrote in message
I need a VBA code to ensure the range to be filled, is empty to begin.
I will select the range, test if the range is empty, then proceed
accordingly.
Thanks




  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 422
Default Test if the range is empty

Thanks for your help.
Jim also

"Jim Cone" wrote in message
:

I would say you are asking it to do something beyond its
design specs. I can't give you the technical explanation,
but the help file says IsEmpty only works on Variant variables.
The fact that it works on single cells is just a nice bonus.
For what it's worth, I usually use Len to check a single cell.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"JMay"
wrote in message
Jim - I opened a new workbook - made no entries into sheet1 (the
activesheet)..

From the immediate Window I entered:
set rng = Activesheet.Range("G1:G5")
? rng.address
$G$1:$G$5
? isempty(rng)
FALSE << WHY???
TIA,
Jim


"Jim Cone"
wrote in message

Application.CountA(rngToBeFilled)
(you don't need to select the range)
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"dan"
wrote in message
I need a VBA code to ensure the range to be filled, is empty to begin.
I will select the range, test if the range is empty, then proceed
accordingly.
Thanks


  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Test if the range is empty

isempty(range("a1").value) will work on a single cell.

That's why Jim used application.counta() for multiple cells.

JMay wrote:

Jim - I opened a new workbook - made no entries into sheet1 (the
activesheet)..

From the immediate Window I entered:
set rng = Activesheet.Range("G1:G5")
? rng.address
$G$1:$G$5
? isempty(rng)
FALSE << WHY???

TIA,
Jim

"Jim Cone" wrote in message
:

Application.CountA(rngToBeFilled)
(you don't need to select the range)
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"dan"
wrote in message
I need a VBA code to ensure the range to be filled, is empty to begin.
I will select the range, test if the range is empty, then proceed
accordingly.
Thanks


--

Dave Peterson
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
Dynamic Ranges using non-contiguous cells and dependent on a cell value Carlo Paoloni Excel Worksheet Functions 2 November 29th 06 07:29 PM
Test if CELL is in RANGE Vaughan Excel Worksheet Functions 12 November 19th 06 02:48 PM
If statement where the logical test is a range that equals a word Steve o Excel Worksheet Functions 8 June 27th 05 02:43 PM
Counting empty cells within a range of cells Rosehill - ExcelForums.com New Users to Excel 2 May 2nd 05 08:53 AM
Eliminate empty cells in data range Stephen Excel Discussion (Misc queries) 1 April 2nd 05 04:00 AM


All times are GMT +1. The time now is 04:16 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"