Ask Your Question

How do I update a named range using a calc macro?

asked 2019-12-26 16:12:58 +0200

jgvicke gravatar image

I know how to remove and add a named range using a macro, but that method breaks equations that reference a named range when it is deleted. Is there a way to directly modify the referenced cells of a named range by macro without using the delete/add method?

Thanks, John Vickers

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2019-12-26 18:28:13 +0200

jmz gravatar image


You can change the referred cells with the "setContent" method of a object:

doc = thiscomponent
namedranges = doc.NamedRanges
myrange = namedranges.getByName("myrange")


edit flag offensive delete link more


Worked like a charm! Thanks!

jgvicke gravatar imagejgvicke ( 2019-12-26 18:50:40 +0200 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2019-12-26 16:12:58 +0200

Seen: 51 times

Last updated: Dec 26 '19