Saturday, April 20, 2019

Autofit Columns and rows


Auto Fit Columns
​Quickly auto fit all the columns in your worksheet. This macro code will select all the cells in your worksheet and instantly auto-fit all the columns.
Sub AutoFitColumns()
Cells.Select
Cells.EntireColumn.AutoFit
End Sub
Auto Fit Rows
You can use this code to auto-fit all the rows in a worksheet. When you run this code it will select all the cells in your worksheet and instantly auto-fit all the row. 
Sub AutoFitRows()
Cells.Select
Cells.EntireRow.AutoFit
End Sub

No comments:

Post a Comment