Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
GUS GUS is offline
external usenet poster
 
Posts: 45
Default determinate if a range is empty

I want find with macro if a range of cells is empty or has at least one
value
(Example: range("A5:c30") )


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 34
Default determinate if a range is empty

Here is one way to do it, if you only need to know if all cells in the
rangfe are empty or at least one cell is not enmpty:

Sub EmptyRange()
For Each c In ActiveWorkbook.ActiveSheet.Range("a5:c30").Cells
If Not IsEmpty(c) Then
MsgBox "At least one cell: " & c.Address & " in the range
contains data", vbonkonly + vbInformation
Exit Sub
End If
Next c
MsgBox "All cells within range are empty", vbOKOnly + vbInformation
End Sub

Jan

"GUS" skrev i en meddelelse
...
I want find with macro if a range of cells is empty or has at least one
value
(Example: range("A5:c30") )




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default determinate if a range is empty

Save hard processing!


If WorksheetFunction.CountA(Plan1.Range("A5:C30")) = Empty Then

....

End If




"GUS" escreveu na mensagem
...
I want find with macro if a range of cells is empty or has at least one
value
(Example: range("A5:c30") )




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.528 / Virus Database: 324 - Release Date: 16/10/2003


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
Test if the range is empty dan Excel Discussion (Misc queries) 6 December 21st 06 03:59 PM
Check for empty range in vba Phil Excel Discussion (Misc queries) 1 April 28th 06 09:57 PM
why is range empty? JT Excel Discussion (Misc queries) 1 March 9th 05 12:26 PM
empty variable range S1 Excel Discussion (Misc queries) 5 January 28th 05 02:33 PM
sum next two non-empty cells in a range Spencer Hutton Excel Worksheet Functions 1 January 9th 05 11:29 PM


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