Avatar of pivar
pivar
Flag for Sweden asked on

Dynamic named range changes with insert

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
Microsoft Excel

Avatar of undefined
Last Comment
pivar

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Ingeborg Hawighorst (Microsoft MVP / EE MVE)

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Jan Karel Pieterse

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?
Ingeborg Hawighorst (Microsoft MVP / EE MVE)

@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
pivar

ASKER
jkpieterse:
I'm using this definition to find the last used row. BigText is =REPT("ö";50)
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23
pivar

ASKER
Thanks, that solved it.

/peter