Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dim sName As String
sName = Cells(1, ActiveCell.Column).Value ThisWorkbook.Names.Add Name:=sName & "_Sheet1", _ RefersTo:="=OFFSET(" & sName & "1!" & Cells(2, _ ActiveCell.Column).Address & _ ",1,0,COUNTA(" & sName & "!" & _ ActiveCell.EntireColumn.Address & ")-1,1)" -- Regards, Tom Ogilvy "burl_rfc_h" wrote in message oups.com... Bob, I tried your solution, I think it's really close with a few tweaks (sorry).... Firstly, ThisWorkbook.Names.Add Name:=sName, _ how can I get it to include the sheet name for example suppose A2 has Date Machined as the column header and the sheet name is Sheet1 then the range name would be Date_Machined_Sheet1 as a suggestion, do you think it would be best to set the worksheet name to a variable, then call this out with sName. Secondly, when I run the macro as written it includes the quotation marks around the formula ="OFFSET(Sheet1!$A$2,1,0,COUNTA(Sheet1!$A:$A)-1,1)" only after removing the quoation marks does the dynmanic range work. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Creating dynamic ranges which are named. | Excel Worksheet Functions | |||
Named Range in Customer Header | Excel Discussion (Misc queries) | |||
Multi-Column Dynamic Named Range...Is there an easier way? | Excel Worksheet Functions | |||
Using a named range in a header with VBA? | Excel Discussion (Misc queries) | |||
Named Range in Center Header | Excel Programming |