+ Reply to Thread
Results 1 to 5 of 5

define a Named Range

Hybrid View

  1. #1
    T. Jenkins
    Guest

    define a 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. #2
    Scott
    Guest

    re: define a 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. #3
    Otto Moehrbach
    Guest

    re: define a Named Range

    Selection.Name="myName"
    HTH Otto
    "T. Jenkins" <TJenkins@discussions.microsoft.com> wrote in message
    news:AC3CD3EA-70B3-480A-BD50-D5FCCDF21F3E@microsoft.com...
    >
    > 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. #4
    Bob Phillips
    Guest

    re: define a Named Range

    Selection.Name:="myName"

    --

    HTH

    Bob Phillips

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

    "T. Jenkins" <TJenkins@discussions.microsoft.com> wrote in message
    news:AC3CD3EA-70B3-480A-BD50-D5FCCDF21F3E@microsoft.com...
    >
    > 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. #5
    Droidy
    Guest

    re: define a 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1