Don\'t know what I\'m missing, but the examples I see posted do not appear to work.
I import data from a web query. I set the query to clear unused cells when it re
Thanks to Claus for having the correct answer, but it is incomplete, and he completed it with a comment on the main post. I'll answer here to combine the useful bits into a single working solution.
Note: I have not tried variations to see which steps are necessary, but these steps work to clear unnecessary used range.
Sub ResetUsedRange()
dim rngToDelete as range
set rngToDelete = 'Whatever you want
rngToDelete.EntireRow.Clear
rngToDelete.EntireRow.Select
Selection.Delete Shift:=xlUp
ActiveWorkbook.Save 'This step has been stated to be necessary for the range to reset.
End Sub