ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Named Range (https://www.excelbanter.com/excel-programming/369644-named-range.html)

T. Jenkins

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


scott

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


Otto Moehrbach

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




Bob Phillips

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




Droidy

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



All times are GMT +1. The time now is 08:48 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com