variable rng used as obj...... revised

Sub T()

    Dim rngCluster As Range
    Dim rng As Range

    Set rngCluster = Application.Union(Range("A1:C3"), Range("D5:E10"))
    For Each rng In rngCluster.Areas
        MsgBox rng.Address
    Next rng

End Sub

On Sun, Jul 29, 2012 at 5:05 PM, Sam Mathai Chacko <samde...@gmail.com>wrote:

> Prince,
>
> I missed the part about selecting to contiguous cell groups. And come to
> think of it, it doesn't necessarily have to be non-empty.
>
> Try this
>
> Sub T()
>
>     Dim rngCluster As Range
>     Dim rng As Range
>
>     Set rngCluster = Application.Union(Range("A1:C3"), Range("D5:E10"))
>     MsgBox rngCluster.Areas.Count
>     For Each obj In rngCluster.Areas
>         MsgBox obj.Address
>     Next obj
>
> End Sub
>
> Regards,
> Sam Mathai Chacko
>
>
> On Sun, Jul 29, 2012 at 4:33 PM, Prince Dubey <prince141...@gmail.com>wrote:
>
>> Hi Sam,
>>
>>
>> Thanks for the reply,
>> I did the same as you have mentioned in your post i created a range A1:E9
>> in which i inserted data from A1:C3 and then D5:E9 and i wrote
>> Sheet1.range(A1:E9).Areas(1).Address but it returned $A$1:$E$9  as address
>> and in case of Sheet1.range(A1:E9).Areas(1).count it returned 1  .
>>
>>
>> regards
>>
>> On Sunday, 29 July 2012 00:28:46 UTC+5:30, Prince Dubey wrote:
>>>
>>> Hi All,
>>>
>>>
>>> I want to know more about Areas property of the range object,
>>>
>>> If I write:  Range("A1").Areas(1) it return text inside that range  but
>>> i m not able to to understand what is it. And further if we write it like
>>> range("A1").Areas.Count or range("A1").Areas.Creator
>>> or range("A1").Areas.Parent , I m not able understand these.
>>>
>>>
>>> Actually i m confused about these statements because i was expecting
>>> that areas will return Areas ie # on of cells in that range, But it is not
>>> in actual.
>>>
>>>
>>> Prince Dubey.
>>>
>>>
>>>
>>>
>>>  --
>> FORUM RULES (986+ members already BANNED for violation)
>>
>> 1) Use concise, accurate thread titles. Poor thread titles, like Please
>> Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice
>> will not get quick attention or may not be answered.
>>
>> 2) Don't post a question in the thread of another member.
>>
>> 3) Don't post questions regarding breaking or bypassing any security
>> measure.
>>
>> 4) Acknowledge the responses you receive, good or bad.
>>
>> 5) Cross-promotion of, or links to, forums competitive to this forum in
>> signatures are prohibited.
>>
>> NOTE : Don't ever post personal or confidential data in a workbook. Forum
>> owners and members are not responsible for any loss.
>>
>>
>> ------------------------------------------------------------------------------------------------------
>> To post to this group, send email to excel-macros@googlegroups.com
>>
>> To unsubscribe, send a blank email to
>> excel-macros+unsubscr...@googlegroups.com
>>
>>
>>
>
>
>
> --
> Sam Mathai Chacko
>



-- 
Sam Mathai Chacko

-- 
FORUM RULES (986+ members already BANNED for violation)

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.

2) Don't post a question in the thread of another member.

3) Don't post questions regarding breaking or bypassing any security measure.

4) Acknowledge the responses you receive, good or bad.

5)  Cross-promotion of, or links to, forums competitive to this forum in 
signatures are prohibited. 

NOTE  : Don't ever post personal or confidential data in a workbook. Forum 
owners and members are not responsible for any loss.

------------------------------------------------------------------------------------------------------
To post to this group, send email to excel-macros@googlegroups.com

To unsubscribe, send a blank email to excel-macros+unsubscr...@googlegroups.com


Reply via email to