@Excel Fox,
I understand what you are saying, but I don't think I can agree. It is my view that UsedRange would be totally useless if the range it referenced depended on how the information was modified. There is no way in code to know how a user removed information, so it would be a total guess for the code to decide what the UsedRange property actually refers to. Consider a user who didn't realize the worksheet was scrolled way down (say to Row 10000) and did something to a cell in Column Z that Excel considers putting it in use. The UsedRange would then (probably) be A1:Z10000. Then, later realizing his/her mistake, removed that data. If I want to do something practical with the used range, some kind of looping code might end up iterating A1:Z100 or A1:Z10000... big difference... the code would have no way of knowing if UsedRange is including 9900 rows of blank cells.
I also think Microsoft intended the UsedRange (at least originally) to function like I assumed. Sometimes, but not always, for the same action (or at least I am pretty sure I have seen it for the same action), Excel will correct the UsedRange while other times it won't. Also, the SpecialCells function uses the UsedRange to restrict its actions... for the LastCell property of the SpecialCells function (for my above example), it might point to a cell on Row 100 and other times Row 10000... that seems completely useless for a property named LastCell. How would one put that to practical use?




Reply With Quote
Bookmarks