Solved

Named Range Create Via VBA

Posted on 2013-01-21
3
262 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
  • 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

In this article we discuss how to recover the missing Outlook 2011 for Mac data like Emails and Contacts manually.
This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

762 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now