Automatic column sizing

Copper Contributor

Is there a function key that will allow one to  paste new column headings over existing column headings and have the system automaitically  adjust the column width to match the new headings?  If not is their a workaround that accomplishes the same task without having to manually change the column width?

 

Thanks...

2 Replies

Hi Henry,

 

You need to a special solution using a VBA code.

 

Hover the Mouse over the worksheet tab, right-click, and select (View Code).

Then copy and paste the below code into the worksheet code module.

Private Sub Worksheet_Change(ByVal Target As Range)
Cells.Columns.AutoFit
End Sub

 

After that, save the workbook as (*.xlsm) to retain the code in it.

Please note that this code applies only to the sheet in which this code is saved.

 

Hope that helps

Highlight the entire column at the top, then Double tap (double click). It will automatically "right size"