![]() |
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 |
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 |
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 |
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 |
All times are GMT +1. The time now is 01:35 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com