+ Reply to Thread
Results 1 to 2 of 2

Is there any way to give an dynamic name for a range?

  1. #1
    salut
    Guest

    Is there any way to give an dynamic name for a range?

    I know we can define dynamic ranges. I am just curious about the names. Is
    there anyway to give it a dynamic name?

    For example, if I refer to another cell which contain the year when define
    some tables. Is there any way to name a range so that when the year is 2005
    then the name would be "Report2005" and next year the name would be
    automatically changed to "Report2006"?

    I am trying to put formulas in insert - > Name - > Define - >Name in
    workbook. But looks like I am not allowed to do so. I hope there is a way
    other than VBA.

    Thanks a lot!

  2. #2
    JAA149
    Guest

    RE: Is there any way to give an dynamic name for a range?

    Dear salut,

    You can give a name dynamicaly either,

    1 - By using the sheet name
    2 - Or by using a value in a cell

    Consider,

    Private Sub Workbook_Open()
    ThisWorkbook.Names.Add Name:="AnyName", _
    RefersTo:="=OFFSET(sht!$A$2,0,0,COUNTA(sht!$A$2:$A$501),1)",
    Visible:=True
    End Sub

    1 - Sheet Name

    Dim DynName()
    DynName = ActiveSheet.Name
    Private Sub Workbook_Open()
    ThisWorkbook.Names.Add Name:=DynName, _
    RefersTo:="=OFFSET(sht!$A$2,0,0,COUNTA(sht!$A$2:$A$501),1)",
    Visible:=True
    End Sub

    Regards

    "salut" wrote:

    > I know we can define dynamic ranges. I am just curious about the names. Is
    > there anyway to give it a dynamic name?
    >
    > For example, if I refer to another cell which contain the year when define
    > some tables. Is there any way to name a range so that when the year is 2005
    > then the name would be "Report2005" and next year the name would be
    > automatically changed to "Report2006"?
    >
    > I am trying to put formulas in insert - > Name - > Define - >Name in
    > workbook. But looks like I am not allowed to do so. I hope there is a way
    > other than VBA.
    >
    > Thanks a lot!


+ 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