Solved

Dynamic named range changes with insert

Posted on 2010-11-08
5
290 Views
Last Modified: 2012-05-10
I have a dynamic named range defined like this:

=Inmatning!$A$3:INDEX(Inmatning!$A:$A;MATCH(BigText;Inmatning!$A:$A))

My problem is when I want to insert a row in the range with this code

Rows("3:3").Insert Shift:=xlDown

the definition of the named range changes to

=Inmatning!$A$4:INDEX(Inmatning!$A:$A;MATCH(BigText;Inmatning!$A:$A))

I need the named range definition to NOT change. How can I solve this?

Thanks,

/peter
0
Comment
Question by:pivar
  • 2
  • 2
5 Comments
 
LVL 50

Accepted Solution

by:
Ingeborg Hawighorst earned 500 total points
ID: 34082553
Hello, you could use=Index(Inmatning!$A:$A,3):INDEX(Inmatning!$A:$A;MATCH(BigText;Inmatning!$A:$A))cheers, teylyn
0
 
LVL 11

Expert Comment

by:jkpieterse
ID: 34082906
Just a remark on your MATCH function: You do know that -since you omitted the third argument- the match does not necessarily return exact matches?
0
 
LVL 50

Expert Comment

by:Ingeborg Hawighorst
ID: 34082918
@JKP,

in this case, the exact match is not required. The purpose of the last Index/Match is to return the last populated cell, hence BigText. Omitting the third argument will default it to 1, which is exactly what the formula should be.

I agree, though, that it's always better to state the argument than to omit it.

cheers, teylyn
0
 
LVL 22

Author Comment

by:pivar
ID: 34082926
jkpieterse:
I'm using this definition to find the last used row. BigText is =REPT("ö";50)
0
 
LVL 22

Author Closing Comment

by:pivar
ID: 34082936
Thanks, that solved it.

/peter
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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.
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

685 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