LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default union of named ranges based only on the names of those ranges

I have a list of names of ranges in column A. How can I create a name
object that refers to the union of all the cells in each of the listed
named ranges?

For example, in column A I have listed: Vol, ARPU, Rev, Exp. Each has
10 values. I would like to create a range called Data that consists of
all 40 cells.

Right now, I'm doing something like this, which works:

Part 1:
Set rng = Union (Range(Application.Names!Vol),
Range(Application.Names!Rev), ...)

.... the code goes on to write values of the union range to Sheet1 and
then activate the first cell in the contiguous range

Part 2:
Dim sDataAddress as String
sDataAddress = ActiveCell.Address
ThisWorkbook.Names.Add Name:="Data", RefersTo:="Sheet1!" & sDataAddress

So what I'm trying to do is in Part 1 not have to refer to each name in
the code, but have the union run based on the names of listed named
ranges in column A.

I'm *guessing* it could be accomplished by creating a string array
based on the lists of names and then looping thru this array and using
the & operator to fill in the arguments for the union.

Also, is there a better way to create the name than what I used in Part
2?

Much appreciation for any help.

 
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
relative Named Ranges based on worksheet Fr. Robert Excel Worksheet Functions 5 June 2nd 09 08:27 PM
Copy worksheet with named ranges to new workbook and keep names Sandy Excel Worksheet Functions 0 July 11th 08 04:37 PM
Copy data in named ranges to a newer version of the same template to identical ranges handstand Excel Programming 0 August 21st 06 03:51 PM
named ranges - changing ranges with month selected gr8guy Excel Programming 2 May 28th 04 04:50 AM
VBA union of two ranges s[_2_] Excel Programming 1 August 21st 03 02:18 AM


All times are GMT +1. The time now is 07:13 AM.

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"