Oct 02 2020 01:32 AM
I'm using excel for a winemaking log. I like my column width and row height to be autofit using VBA coding. The issue is, I have used at least 15 different ways of coding, that I've found online or done myself, and the corrections just aren't happening. Any thoughts or help?
Oct 02 2020 04:52 AM - edited Oct 02 2020 04:59 AM
Problem: Excel cannot autofit merged cells. Column A has no cells that are not merged so Excel has no idea what size A should be.
Fix: Row 122 has no merged cells and no content. Place entries in row 122 for columns A:N that represent the column width you want for each column then use this VBA.
Sub Auto_Size()
[A:N].EntireColumn.AutoFit
End sub
If you want to set all columns to the same size use this instead.
Sub Auto_Size()
[A:N].ColumnWidth = 7
End sub