Solved

Named Range Create Via VBA

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …
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.

815 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

11 Experts available now in Live!

Get 1:1 Help Now