#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default Named Range


I'm trying to define a named range based on the selection. The help covers
the following simple scenario.

ActiveWorkbook.Names.Add Name:="myName", RefersToR1C1:= _
"=Sheet1!R1C1"

Can someone please show me how to change this based on the currently
selected range?

Thanks,
Todd

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 577
Default Named Range

If you're doing it manually (ie not through VBA) then just hit cntrl-F3 and
it will give you a "Define Name" window. here just choose a name and then
it's like making a graph, just click where you want to define your range.

Cheers,

Scott

"T. Jenkins" wrote:


I'm trying to define a named range based on the selection. The help covers
the following simple scenario.

ActiveWorkbook.Names.Add Name:="myName", RefersToR1C1:= _
"=Sheet1!R1C1"

Can someone please show me how to change this based on the currently
selected range?

Thanks,
Todd

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,090
Default Named Range

Selection.Name="myName"
HTH Otto
"T. Jenkins" wrote in message
...

I'm trying to define a named range based on the selection. The help
covers
the following simple scenario.

ActiveWorkbook.Names.Add Name:="myName", RefersToR1C1:= _
"=Sheet1!R1C1"

Can someone please show me how to change this based on the currently
selected range?

Thanks,
Todd



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 380
Default Named Range

Selection.Name:="myName"

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"T. Jenkins" wrote in message
...

I'm trying to define a named range based on the selection. The help

covers
the following simple scenario.

ActiveWorkbook.Names.Add Name:="myName", RefersToR1C1:= _
"=Sheet1!R1C1"

Can someone please show me how to change this based on the currently
selected range?

Thanks,
Todd



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Named Range

This code takes the used range of a spreadsheet and assigns a name of
Database to it.
Useful for pivot tables or advanced filtering. Courtesy of Debra
Dalgleish



Public Sub SetNamedRange()

ActiveWorkbook.Names.Add NAME:="Database", _
RefersTo:=Worksheets("Data").UsedRange

End Sub

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
automatic range - named range give me circular reference... George Thorogood Excel Discussion (Misc queries) 0 February 22nd 07 07:53 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
Compare a selected Range with a Named range and select cells that do not exist PCLIVE Excel Programming 1 October 18th 05 07:09 PM
If any cell in named range = 8 then shade named range JJ[_8_] Excel Programming 3 August 26th 05 11:09 PM


All times are GMT +1. The time now is 12:38 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"