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

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?

John Vickers


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

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


Worked like a charm! Thanks!