LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7
Default Named range with multiple groups of cells

Hello,
I am attempting to use named ranges consisting of quite a few cells which
are not joined in a group.
Ive created them by selecting the first cell of the range, then holding
down the Ctrl button and selecting the rest, before giving the range a name.
Im running into problems when I need to add or remove a cell in one of the
ranges. Say for example a range consisting of thirty separate cells; when
looking at the list in the €śDefine Name€ť box, and trying to see the cells
already in the range along the €śRefers to:€ť line, I can only see about the
first five or six. If I click in the line and try to view further along the
list, it appears to add extra random cells to it, and if I type in a new cell
at the front, it doesnt seem to accept it. Im using Excel 2003, by the way.
The way Ive been getting round this is by deleting the range and recreating
it with the added cells. This is tedious and seems morally wrong.
Ive been experimenting with recording Macros to see if I can maintain a
range that way, but it doesnt work very well. Here are my examples:

1. Sub Macro1()
Range("A1:A4").Select
ActiveWorkbook.Names.Add Name:="Range_1",
RefersToR1C1:="=Sheet1!R1C1:R4C1"
End Sub
1. This one is ok, because its just a group together. I can increase the
size by changing the text above from "=Sheet1!R1C1:R4C1" to
"=Sheet1!R1C1:R5C1".

2. Sub Macro2()
Range("B1,B3,B5,B7").Select
Range("B7").Activate
ActiveWorkbook.Names.Add Name:="Range_2 ", RefersToR1C1:= _
"=Sheet1!R1C2,Sheet1!R3C2,Sheet1!R5C2,Sheet1!R 7C2"
End Sub
2. This one's not so good. If I add Sheet1!R9C2 to it, nothing happens.
If I insert some rows between rows three and five the cells in the range
remain correct, but the cell references in the VB text dont change. I know I
can change these manually, but Im trying to keep things as simple and
efficient as possible.
Also, a list of even thirty of these in the VB text makes one single very
long ugly line, which I dont seem to be able to reduce by putting it on
multiple lines.
Each one of the cells is individually named and most are quite long names by
neccessity. This doesn't help with the reduction of text either.

Does anybody know a more efficient way of doing this? My knowledge of VB is
very limited, consisting of a few basic instructions, so I would really
appreciate some help.

Thank you
Kind regards
Clinton



 
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
Multiple Named Range questions Carole O Excel Discussion (Misc queries) 3 July 3rd 07 12:12 PM
Multiple instances of a named range, not in the list DaveO[_2_] Excel Discussion (Misc queries) 4 April 16th 07 10:34 PM
Array as a "named range" - formula ok in cells, but error as "named range" tskogstrom Excel Discussion (Misc queries) 11 December 28th 06 04:44 PM
inserting a named range into new cells based on a named cell Peter S. Excel Discussion (Misc queries) 1 June 4th 06 03:53 AM
same named range on multiple worksheets? Philip Reece-Heal Excel Discussion (Misc queries) 4 June 1st 06 11:37 PM


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