E
Elaine J.
I have 16 workbooks open. I want to go through each one and autofit the
columns. Specifically I want to autofit the columns, then save and close
each workbook. The workbooks are already named and saved once, but I need to
resave the changes.
This is the code that I am using:
Dim wsheet As Range
Dim wb As Workbook
Dim wWorkbooks As Collection
For Each wb In Workbooks
Set wsheet = ActiveWorkbook.Worksheets("Sheet1").Range("A1:AG25")
With wsheet
.Select
.Columns.AutoFit
.save
.close
End With
next wb
It will autofit the columns on about three of the files and save (but not
close). Then it just stops.
Any help would be appreciated.
Elaine
columns. Specifically I want to autofit the columns, then save and close
each workbook. The workbooks are already named and saved once, but I need to
resave the changes.
This is the code that I am using:
Dim wsheet As Range
Dim wb As Workbook
Dim wWorkbooks As Collection
For Each wb In Workbooks
Set wsheet = ActiveWorkbook.Worksheets("Sheet1").Range("A1:AG25")
With wsheet
.Select
.Columns.AutoFit
.save
.close
End With
next wb
It will autofit the columns on about three of the files and save (but not
close). Then it just stops.
Any help would be appreciated.
Elaine