Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default name ranges in array

Hi Folks,

Can anyone help with the array feed please?

I have numerous name ranges in the file and i want to feed an array with it.
Let say i have K number of ranges. How do i feed Ranges() array with it?

Thanks
Igor
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default name ranges in array

I'm not sure what you're doing, but Union sounds like it might be what you're
looking for.

Dim K as long
dim rCtr as long
dim myRngs() as range
dim OneRng as range

k = 3
redim myRngs(1 to K)

with worksheets("Sheet9999")
set myrngs(1) = .range("A1")
set myrngs(2) = .range("w1:z1")
set myrngs(3) = .range("L9")
end with

set onerng = myrngs(lbound(myrngs))
for rctr = lbound(myrngs) + 1 to ubound(myrngs)
set onerng = union(onerng, myrngs(rctr))
next rctr

msgbox onerng.address

igorek wrote:

Hi Folks,

Can anyone help with the array feed please?

I have numerous name ranges in the file and i want to feed an array with it.
Let say i have K number of ranges. How do i feed Ranges() array with it?

Thanks
Igor


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default name ranges in array

Dave,
this is not exactly what i'm trying to do. the name ranges that i'm
referring to (Ctrl+F3) need to be fed into an array. And i do not know how to
do that. can you please let me know how to do it via look that goes through
ActiveWorkbook.Names

thanks
Igor


"Dave Peterson" wrote:

I'm not sure what you're doing, but Union sounds like it might be what you're
looking for.

Dim K as long
dim rCtr as long
dim myRngs() as range
dim OneRng as range

k = 3
redim myRngs(1 to K)

with worksheets("Sheet9999")
set myrngs(1) = .range("A1")
set myrngs(2) = .range("w1:z1")
set myrngs(3) = .range("L9")
end with

set onerng = myrngs(lbound(myrngs))
for rctr = lbound(myrngs) + 1 to ubound(myrngs)
set onerng = union(onerng, myrngs(rctr))
next rctr

msgbox onerng.address

igorek wrote:

Hi Folks,

Can anyone help with the array feed please?

I have numerous name ranges in the file and i want to feed an array with it.
Let say i have K number of ranges. How do i feed Ranges() array with it?

Thanks
Igor


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,049
Default name ranges in array

Option Explicit
Sub Text()
Dim allnames() As String
Dim nm As Name
Dim index As Long

ReDim allnames(1 To ThisWorkbook.Names.Count)

For Each nm In ThisWorkbook.Names
index = index + 1
allnames(index) = nm.Name
Next

MsgBox index & " names in the array"

End Sub

"igorek" wrote in message
...
Dave,
this is not exactly what i'm trying to do. the name ranges that i'm
referring to (Ctrl+F3) need to be fed into an array. And i do not know how
to
do that. can you please let me know how to do it via look that goes
through
ActiveWorkbook.Names

thanks
Igor


"Dave Peterson" wrote:

I'm not sure what you're doing, but Union sounds like it might be what
you're
looking for.

Dim K as long
dim rCtr as long
dim myRngs() as range
dim OneRng as range

k = 3
redim myRngs(1 to K)

with worksheets("Sheet9999")
set myrngs(1) = .range("A1")
set myrngs(2) = .range("w1:z1")
set myrngs(3) = .range("L9")
end with

set onerng = myrngs(lbound(myrngs))
for rctr = lbound(myrngs) + 1 to ubound(myrngs)
set onerng = union(onerng, myrngs(rctr))
next rctr

msgbox onerng.address

igorek wrote:

Hi Folks,

Can anyone help with the array feed please?

I have numerous name ranges in the file and i want to feed an array
with it.
Let say i have K number of ranges. How do i feed Ranges() array with
it?

Thanks
Igor


--

Dave Peterson

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
Array formula: how to join 2 ranges together to form one array? Rich_84 Excel Worksheet Functions 2 April 1st 09 06:38 PM
looping through an array of ranges Arnold Klapheck Excel Programming 1 September 28th 06 06:46 PM
Looking up named ranges as an array L.White Excel Programming 1 August 26th 05 09:12 PM
Array and Named Ranges [email protected] Excel Programming 2 January 10th 04 02:37 PM
variant array containing cel adresses convert to actual ranges-array Peter[_21_] Excel Programming 5 December 10th 03 09:50 PM


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