Forum Discussion

Riley_Johnson's avatar
Riley_Johnson
Copper Contributor
Apr 14, 2024
Solved

Measuring Sheet Size Using VBA

Any ideas to improve this code?   This macro is intended to calculate the size of each sheet in Excel. In practice, it will trim fat from a template frequently used at work. For instance, a decisio...
  • JKPieterse's avatar
    Apr 15, 2024

    Riley_Johnson If the workbook is in xlsx or xlsm format, you could look in the zip container to see the size of each sheet's xml file:

    Using my editOpenXML example code you could easily extract the xml of any sheet and measure how large it is by taking the Len of the returned (xml) string. See https://jkp-ads.com/articles/excel2007fileformat02.asp 

Resources