Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
salut
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.excel.misc
JAA149
 
Posts: n/a
Default 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
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
dynamic summed range based on a variable Bruce Excel Worksheet Functions 3 November 8th 05 02:45 AM
Dynamic range name problem [email protected] Excel Discussion (Misc queries) 2 September 23rd 05 12:52 AM
dynamic range GEORGIA Excel Discussion (Misc queries) 10 June 29th 05 03:02 AM
How to dynamically reference a dynamic named range paris3 Excel Worksheet Functions 4 June 24th 05 01:22 AM
Add a Dynamic Range with 2 Conditions Q John Excel Worksheet Functions 7 December 23rd 04 02:58 PM


All times are GMT +1. The time now is 04:23 PM.

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"