Solved

Named Range Create Via VBA

Posted on 2013-01-21
3
302 Views
Last Modified: 2013-01-21
Hello

I am trying to create a Dynnamic named  range with VBA. But I am getting error.

ActiveWorkbook.Names.Add Name:="MyDynamicRange", _
                             RefersToR1C1:="=Extract201!$A$1:INDEX(Extract201!$O:$O,MATCH(REPT(""z"",20),Extract201!$A:$A))"


Please assist

Thank you
'
namedRngError.png
0
Comment
Question by:Rayne
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 

Author Comment

by:Rayne
ID: 38803203
I can create it by pressing Ctrl + F3 in the named range manger. But I actually want to do it in VBA code as this should be dynamic...
0
 
LVL 24

Accepted Solution

by:
Steve earned 500 total points
ID: 38803254
Could it be that you have not used R1C1 references...
Have added a delete too, but not nescessary

'ActiveWorkbook.Names("MyDynamicRange").Delete
ActiveWorkbook.Names.Add Name:="MyDynamicRange", RefersToR1C1:= _
"=Extract201!R1C1:INDEX(Extract201!C15,MATCH(REPT(""z"",20),Extract201!C1))"

Open in new window

0
 

Author Comment

by:Rayne
ID: 38803289
thank you The_Barman :)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
This article describes a serious pitfall that can happen when deleting shapes using VBA.
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question