Hi All,
I have noticed that allthough I have been autofitting my data on each sheet in my workbooks when people have opened them the autofit has gone so I have added some code so when they open the workbook it runs through and autofits the sheets this is working fine.
My question is: As I have about 28 workbooks several times a month that would need this code to be added to is it possible to create a macro that copies the following code to each workbook in a specific folder, lets just say "my documents" for now or will i need to add this code manually?
The code is as follows: -
Private Sub Workbook_Open()
Dim wrksht As Worksheet
For Each wrksht In Worksheets
Application.ScreenUpdating = False
wrksht.Select
Cells.EntireColumn.AutoFit
Next wrksht
Sheets(1).Select
Application.ScreenUpdating = True
End Sub
Any help you can give me would be appreciated.
Regards
Paul
I have noticed that allthough I have been autofitting my data on each sheet in my workbooks when people have opened them the autofit has gone so I have added some code so when they open the workbook it runs through and autofits the sheets this is working fine.
My question is: As I have about 28 workbooks several times a month that would need this code to be added to is it possible to create a macro that copies the following code to each workbook in a specific folder, lets just say "my documents" for now or will i need to add this code manually?
The code is as follows: -
Private Sub Workbook_Open()
Dim wrksht As Worksheet
For Each wrksht In Worksheets
Application.ScreenUpdating = False
wrksht.Select
Cells.EntireColumn.AutoFit
Next wrksht
Sheets(1).Select
Application.ScreenUpdating = True
End Sub
Any help you can give me would be appreciated.
Regards
Paul