Automatic column sizing

Occasional Visitor

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?



1 Reply

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)
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

Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
46 Replies
Extentions Synchronization
Deleted in Discussions on
3 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
Security Community Webinars
Valon_Kolica in Security, Privacy & Compliance on
13 Replies
flashing a white screen while open new tab
Deleted in Discussions on
14 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
29 Replies