Excel resetting “UsedRange”

前端 未结 12 2180
醉酒成梦
醉酒成梦 2021-01-05 15:42

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

12条回答
  •  被撕碎了的回忆
    2021-01-05 16:06

    If you call the Worksheet.UsedRange property by itself, it will reset.

        With Worksheets("Sheet1")
            Debug.Print .UsedRange.Address(0, 0)
            .UsedRange.Clear
            .UsedRange    '<~~ called by itself will reset it
            Debug.Print .UsedRange.Address(0, 0)
        End With
    

    This extra step is unnecessary in xl2010 and above with all appropriate service packs installed.

提交回复
热议问题