Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi. I have successfully made Dynamic Name Ranges through the Excel
Insert/Name menu. In the Refers To text box I would write something like: =OFFSET(Sheet1!$A$1,0,0,COUNTA(Sheet1!$A:$A),1) I tried vba code like: Activeworksheet.Names.Add ...... and so on. However, when I try to write code in vba to do this, it fails. How should I write the code without the ReferTo part to fail? Thanks a lot for any help! Regards Jan |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try this:
ActiveWorkbook.Names.Add _ Name:="MyDynRng", _ RefersTo:="=OFFSET(Sheet1!$A$1,0,0,COUNTA(Sheet1!$ A:$A),1)" Is that something you can work with? -------------------------- Regards, Ron Microsoft MVP (Excel) (XL2003, Win XP) "Jan T." wrote in message ... Hi. I have successfully made Dynamic Name Ranges through the Excel Insert/Name menu. In the Refers To text box I would write something like: =OFFSET(Sheet1!$A$1,0,0,COUNTA(Sheet1!$A:$A),1) I tried vba code like: Activeworksheet.Names.Add ...... and so on. However, when I try to write code in vba to do this, it fails. How should I write the code without the ReferTo part to fail? Thanks a lot for any help! Regards Jan |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On 3 Feb, 00:12, "Jan T." wrote:
Hi. I have successfully made Dynamic Name Ranges through the Excel Insert/Name menu. In the Refers To text box I would write something like: =OFFSET(Sheet1!$A$1,0,0,COUNTA(Sheet1!$A:$A),1) I tried vba code like: Activeworksheet.Names.Add ...... and so on. However, when I try to write code in vba to do this, it fails. How should I write the code without the ReferTo part to fail? Thanks a lot for any help! Regards Jan Thank you so much. That was excactly what I needed! Regards Jan |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Adding a Range | Excel Worksheet Functions | |||
Adding to a Row Range | Excel Programming | |||
Adding named range gives error "method range of object _Global failed " | Excel Programming | |||
adding reference-to-range control to excel range | Excel Programming | |||
sheets.range and adding cells that are out of the range | Excel Programming |