Embedded code to auto re-size columns no longer working in win10/excel2016

paquirl

Board Regular
Joined
Oct 12, 2010
Messages
226
Office Version
  1. 2016
Platform
  1. Windows
I had this embedded code in a worksheet to auto re-size columns. When I upgraded to win10/excel2016 it no longer works. Please help!

Code:
Option Explicit

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
    Application.ScreenUpdating = False
    ActiveSheet.Columns.AutoFit
End Sub
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
If you run this
Code:
Sub chk()
Application.EnableEvents = True
End Sub
does your code work again?
 
Upvote 0
actually it works now on some columns ... :(
i'll try yours
 
Last edited:
Upvote 0
Apparently my old code still works, but it's slowwwwww.
Also, excel2016 is disabling my macros and i have to hit a button to enable them on each wkbk. Do you know where the setting to toggle this feature is located so the macros are enabled by default?
 
Upvote 0
Its in File > Options >Trust center > Trust center settings
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top