Forum Discussion

Patrick_virtualFD's avatar
Patrick_virtualFD
Brass Contributor
Jan 18, 2023
Solved

Office script version of VBA for column autofit?

hi everyone,   Do you know if there's a way to mimic the behaviour of the VBA command cells.entirecolumn.autofit using Office Script?   I've managed to get this behaviour on a particular table (a...
  • wma1840's avatar
    Feb 03, 2023
    You can use something like:
    selectedSheet.getRange("D8:J8").getFormat().autofitColumns();
    See:
    https://learn.microsoft.com/en-gb/office/dev/scripts/tutorials/excel-read-tutorial

Resources