I have a worksheet with with over 1000 columns. How can I select all columns in that sheet and auto adjust every column width. I tried
Sheets(1).Select
Selection.EntireColumn.AutoFit
But it didn't work. Any ideas?
Select the column or columns that you want to change. On the Home tab, in the Cells group, click Format. Under Cell Size, click AutoFit Column Width. Note: To quickly autofit all columns on the worksheet, click the Select All button, and then double-click any boundary between two column headings.
To AutoFit column width, select one, several or all columns on the sheet, go to the Home tab > Cells group, and click Format > AutoFit Column Width. To AutoFit row height, select the row(s) of interest, go to the Home tab > Cells group, and click Format > AutoFit Row Height.
Try this...
Sheets(1).UsedRange.Columns.AutoFit
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With