简体   繁体   中英

.Clear Vs .Delete to reduce document size - VBA

Guys which of the below in better to be used in order to reduce document size?

.Clear

.Delete

Have in mind that worksheet includes a variety of formats (cell fill with colors, hyperlinks, bolds etc)

Interesting question. Following is my test and observation.

I populated entire column A and saved workbook. Size is 5556 KB .

I used Delete method

Range("A524288:A1048576").Delete xlUp

After saving, workbook size is 2784 KB .

Then I used Clear as below

Range("A524288:A1048576").Clear

After saving, workbook size is 2784 KB ie exactly the same. So no impact on the size of workbook in this particular case!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM