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: 8
Default Macro to name a range

Thanks for all your help Tom

using the macro recorder, i came up with this:

Sub NameRange()
Range("B7:L10").Select
ActiveWorkbook.Names.Add Name:="Daniel_40",
RefersToR1C1:= _
"='CHA SQ'!R7C2:R10C12"
End Sub

i am working with 2 sheets. sheet "CHA SQ" and "Sheet2"

in cell J6 of Sheet 2 i have the text B7 (coming from an
INDIRECT formula) and likewise in cell K6 of sheet 2 i
have the text L10. the range B7:L10 is on "CHA SQ"
i am needing to modify this recorded macro to be able to
name the range B7:L10 "Daniel_40" (B7:L10 may change
every month but the formulae will change. i need the
macro to name the range specified in the two cells. i
would use something like OFFSET, however the sheet CHA SQ
is emailed to me every month and i copy it and paste it
over top of the previous months sheet, and re-name a
dozen or so ranges every month (somewhat time
comsuming). i tried using the INDIRECT function in the
Refers To: section of the Define Names dialog box to
reference J6 and K6 in hopes of returning the named
range, but apparantley you cannot use INDIRECT in the
worksheet referring to the same range that the name is
referring to. i need to use INDIRECT in the worksheet
for other things so using it in the range's name is out
of the question i guess. all i need is to modify this
macro to get it to name B7:L10 (which may change every
month) so n ext month it may be B7:L9 but the cells that
contain that text are already changingdue to some other
formulae. I hope that wasn't too confusing, TIA if this
is possible.
 
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
Macro range puiuluipui Excel Discussion (Misc queries) 4 April 8th 09 01:52 PM
How to use a range name in a macro CompetiveLat Excel Worksheet Functions 2 July 22nd 08 06:40 PM
Macro deletes row in range, macro then skips the row moved up steven.holloway Excel Discussion (Misc queries) 8 June 11th 08 11:40 AM
macro pop-up to set range? NPell Excel Worksheet Functions 0 April 25th 08 03:48 PM
Name a Range - Macro Danny Excel Worksheet Functions 0 October 14th 05 05:24 AM


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