30 Jun

Clearing Shrinking Ranges

We have just been working on an implementation in which our data items are defined by named ranges that use formulae, so they expand as the data set expands. When they shrink, they leave old data behind on the sheet. To clear this old data, you can use code such as:

xlDown = -4121
# print ActiveSheet.Range(ActiveSheet.Range(“test”),ActiveSheet.Range(“test”).End(xlDown)).Address()
ActiveSheet.Range(ActiveSheet.Range(“test”),ActiveSheet.Range(“test”).End(xlDown)).Clear()

Leave a Reply

Your email address will not be published. Required fields are marked *