View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tim Marsh Tim Marsh is offline
external usenet poster
 
Posts: 49
Default 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