LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 789
Default Problem collecting Range Values

Hi
I sent you solution privately, but just for this thread:

An array of Ranges output:

Function Tester2() As Variant
Dim OutputRanges() As Range, i As Integer
AreaCount = Selection.Areas.Count
ReDim OutputRanges(1 To AreaCount)
For i = 1 To AreaCount
Set OutputRanges(i) = Selection.Areas(i)
Next i
Tester2 = OutputRanges
End Function

Public Sub test()
Dim myValues As Variant
For i = 1 To UBound(Tester2)
Set Testarea = Tester2(i)
MsgBox Testarea.Address
Next i
End Sub

A Collection of Ranges output:

Function Tester2() As Collection
Dim OutputRanges As New Collection, i As Integer
AreaCount = Selection.Areas.Count
For i = 1 To AreaCount
OutputRanges.Add Selection.Areas(i), "Area" & i
Next i
Set Tester2 = OutputRanges
End Function

Public Sub test()
Dim Testarea as Range
Dim myValues As Variant
For i = 1 To Tester2.Count
Set Testarea = Tester2("Area" & i)
MsgBox Testarea.Address
Next i
End Sub

regards
Paul

 
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
Problem with getting numbers in some range values!? Ivica TypeR Excel Worksheet Functions 2 July 10th 07 01:29 AM
Stumped! Collecting values into one cell. AthleteTO Excel Worksheet Functions 5 November 2nd 04 04:24 PM
Stumped! Collecting values into one cell. AthleteTO Excel Worksheet Functions 0 November 1st 04 07:29 PM
Collecting values for later display? Ed[_9_] Excel Programming 4 August 4th 03 04:50 PM
collecting previous values adil Excel Programming 1 July 31st 03 04:31 PM


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