Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Quickly determining whether any values in a range are empty

Hi there,

I am trying to find a way of quickly determining whether any values in
a range are empty, preferably without scanning the contents of the
cells individually.

For instance, it would be ideal to have something like
Sheet1.range("A1:A10").value = NullArray where NullArray is an array of
Null values of the same length as the number of cells being checked.

1. Is this possible?
2. If not, can someone suggest a better way, say using VBA with a range
formula or similar method?

I was trying to avoid the expensive alternative of doing something
like:

NullValue = False
numRows = Sheet1.Range("A1:A10").End(xlUp).Row
for i in 1 to numRows
if len(Sheet1.range("A" & i).value) = 0 then
NullValue = True
end if
next i


Any assistance would be appreciated.

Regards,

Ric

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default Quickly determining whether any values in a range are empty

Hi Ric,

Try something like:

Dim rng As Range

Set rng = Range("A1:A10")

If Application.CountA(rng) < rng.Count Then
MsgBox "Empty cells present in range"
End If


---
Regards,
Norman


"ric_deez" wrote in message
oups.com...
Hi there,

I am trying to find a way of quickly determining whether any values in
a range are empty, preferably without scanning the contents of the
cells individually.

For instance, it would be ideal to have something like
Sheet1.range("A1:A10").value = NullArray where NullArray is an array of
Null values of the same length as the number of cells being checked.

1. Is this possible?
2. If not, can someone suggest a better way, say using VBA with a range
formula or similar method?

I was trying to avoid the expensive alternative of doing something
like:

NullValue = False
numRows = Sheet1.Range("A1:A10").End(xlUp).Row
for i in 1 to numRows
if len(Sheet1.range("A" & i).value) = 0 then
NullValue = True
end if
next i


Any assistance would be appreciated.

Regards,

Ric



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default Quickly determining whether any values in a range are empty

Hi Norman,

That was concise and clever!!! Thank for your prompt response...

Ric

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
Entering Values and Updating Next Empty Cell in a Range Stilltrader47 Excel Worksheet Functions 2 March 14th 10 03:53 AM
Determining Excel Formats quickly. cardosol Excel Discussion (Misc queries) 1 May 1st 08 09:59 PM
Copy Values to next empty cell range Aldo Cella Excel Worksheet Functions 1 March 10th 08 11:22 PM
Cells may look "empty" when quickly scrolling up or down DoctorG Excel Discussion (Misc queries) 2 August 21st 07 02:22 PM
Determining if values in a column range are of same value. Bing Excel Programming 5 March 14th 05 12:43 PM


All times are GMT +1. The time now is 12:44 AM.

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"