Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default dynamic Ranges

Hallo,
How to check if dynamic range is empty (no content)?
Thank you for help.
Elias


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default dynamic Ranges

is the ISEMPTY function?

Sub TestFunction()
MsgBox CheckEmpty("MyData")
End Sub

Function CheckEmpty(sRangeName As String) As Boolean
Dim cell As Range
CheckEmpty = True
For Each cell In Range(sRangeName).Cells
If Not IsEmpty(cell) Then
CheckEmpty = False
Exit For
End If
Next

End Function


I'm pretty sure that there's a better way
....aha !

Function CheckEmpty(sRangeName As String) As Boolean
CheckEmpty = WorksheetFunction.CountA(Range(sRangeName)) = 0
End Function

om a sheet name a range like "MyData"
in another cell
=COUNTA(MyData)=0
....will be TRUE if there's nothing in the range

Patrick Molloy
Microsoft Excel MVP

"adehilis" wrote:

Hallo,
How to check if dynamic range is empty (no content)?
Thank you for help.
Elias



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default dynamic Ranges

If application.counta(sRangeName) = 0 then
'it's empty
else
'it's not
end if

Maybe???

Patrick Molloy wrote:

is the ISEMPTY function?

Sub TestFunction()
MsgBox CheckEmpty("MyData")
End Sub

Function CheckEmpty(sRangeName As String) As Boolean
Dim cell As Range
CheckEmpty = True
For Each cell In Range(sRangeName).Cells
If Not IsEmpty(cell) Then
CheckEmpty = False
Exit For
End If
Next

End Function

I'm pretty sure that there's a better way
...aha !

Function CheckEmpty(sRangeName As String) As Boolean
CheckEmpty = WorksheetFunction.CountA(Range(sRangeName)) = 0
End Function

om a sheet name a range like "MyData"
in another cell
=COUNTA(MyData)=0
...will be TRUE if there's nothing in the range

Patrick Molloy
Microsoft Excel MVP

"adehilis" wrote:

Hallo,
How to check if dynamic range is empty (no content)?
Thank you for help.
Elias




--

Dave Peterson
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default dynamic Ranges



Thank you a lot for reply ,
i used it it works ,thanks again.
I thought that there are in vba spcial methode to handel range.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
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
Help with dynamic ranges JoAnn New Users to Excel 2 March 25th 08 03:19 PM
Dynamic Ranges PAL Excel Worksheet Functions 3 January 25th 08 07:52 PM
how to do a dynamic ranges? MadCow Excel Worksheet Functions 2 April 5th 06 02:13 PM
Dynamic Formulas with Dynamic Ranges Ralph Howarth Excel Worksheet Functions 5 January 21st 05 08:44 AM
Dynamic Ranges Q John[_78_] Excel Programming 6 December 9th 04 04:07 AM


All times are GMT +1. The time now is 09:46 PM.

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"