ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   creating a dynamic range name using vba (https://www.excelbanter.com/excel-programming/378700-creating-dynamic-range-name-using-vba.html)

Tim Marsh

creating a dynamic range name using vba
 
Hi All,

I use dynamic ranges alot, but for the first time i am trying to create a
named range in a workbook using vba (dynamic for columns and rows based on
Column A and Row 1).

the very basic procedure is as follows: -

Sub TimTabMaker()
ActiveWorkbook.Names.Add Name:="timtab",
RefersTo:="=OFFSET(Calendar!$A$1,0,0,COUNTA(Calend ar!$A:$A),COUNTA(Calendar!$1:$1)"
End Sub

but when i run it i get a '1004' run-time error, indicating there is a
problem with the formula. I'm guessing there is a very simple reason for
this, but i cannot see it. can you help?!

any help is (as always) appreciated.

cheers guys,

Tim



Tim Marsh

creating a dynamic range name using vba
 
sorry... i've just realised, i missed the end bracket... DOH!!

"Tim Marsh" <tmarsh-trousers-@-take off my trousers to
reply-blueyonder.co.uk wrote in message
...
Hi All,

I use dynamic ranges alot, but for the first time i am trying to create a
named range in a workbook using vba (dynamic for columns and rows based on
Column A and Row 1).

the very basic procedure is as follows: -

Sub TimTabMaker()
ActiveWorkbook.Names.Add Name:="timtab",
RefersTo:="=OFFSET(Calendar!$A$1,0,0,COUNTA(Calend ar!$A:$A),COUNTA(Calendar!$1:$1)"
End Sub

but when i run it i get a '1004' run-time error, indicating there is a
problem with the formula. I'm guessing there is a very simple reason for
this, but i cannot see it. can you help?!

any help is (as always) appreciated.

cheers guys,

Tim





All times are GMT +1. The time now is 09:42 AM.

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