Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 127
Default find a non-empty cell

Dear experts,
what is the quickest VBA way to determine in a big cells range if at least
one of them is non empty?
Many thanks for your help!
Best regards

--
Valeria
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default find a non-empty cell

Does this help..


Set varRange = Selection.Find("*")
If Not varRange Is Nothing Then MsgBox "Data exist in this range"

--
Jacob (MVP - Excel)


"Valeria" wrote:

Dear experts,
what is the quickest VBA way to determine in a big cells range if at least
one of them is non empty?
Many thanks for your help!
Best regards

--
Valeria

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default find a non-empty cell

Hi,

This tells you the empty cells in a range and you can modify this easily to
tell you how many cells are not empty


If WorksheetFunction.CountA(Range("A1:c1000")) = _
Range("A1:C1000").Cells.Count Then
MsgBox "No empty cells"
Else
num = Range("A1:C1000").Cells.Count - _
WorksheetFunction.CountA(Range("A1:c1000"))
MsgBox num & " Empty cells in range"
End If
--
Mike

When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.


"Valeria" wrote:

Dear experts,
what is the quickest VBA way to determine in a big cells range if at least
one of them is non empty?
Many thanks for your help!
Best regards

--
Valeria

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 127
Default find a non-empty cell

Works very well, thank you very much!
--
Valeria


"Jacob Skaria" wrote:

Does this help..


Set varRange = Selection.Find("*")
If Not varRange Is Nothing Then MsgBox "Data exist in this range"

--
Jacob (MVP - Excel)


"Valeria" wrote:

Dear experts,
what is the quickest VBA way to determine in a big cells range if at least
one of them is non empty?
Many thanks for your help!
Best regards

--
Valeria

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default find a non-empty cell

You didn't have to set the Find call to a variable before testing for data
in the range; this works the same way your code does...

If Not Selection.Find("*") Is Nothing Then MsgBox "Data exist in the range"

--
Rick (MVP - Excel)



"Jacob Skaria" wrote in message
...
Does this help..


Set varRange = Selection.Find("*")
If Not varRange Is Nothing Then MsgBox "Data exist in this range"

--
Jacob (MVP - Excel)


"Valeria" wrote:

Dear experts,
what is the quickest VBA way to determine in a big cells range if at
least
one of them is non empty?
Many thanks for your help!
Best regards

--
Valeria


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
Find empty cell tkraju via OfficeKB.com Excel Programming 3 April 2nd 09 11:46 AM
Find first Empty Cell in a row Scott R[_2_] Excel Programming 1 February 11th 09 07:46 PM
find empty cells in a column then append row that empty cell is in vbnewbie Excel Programming 9 January 29th 09 09:27 AM
To find empty cell Asu Excel Programming 3 December 3rd 05 05:44 PM
Please help find the next empty cell pcarsquared Excel Programming 5 May 17th 04 10:23 PM


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