X
Xluser@work
I am trying to resize the columns in all sheets of a workbook and I have a
number of workbooks each with a different number of sheets.
The code I have so far is:
For Each Worksheet In ActiveWorkbook.Worksheets
Columns("A:A").EntireColumn.ColumnWidth = 30.71
Columns("B:B").EntireColumn.ColumnWidth = 8.57
Columns("C:C").EntireColumn.ColumnWidth = 8.57
Columns("D").EntireColumn.ColumnWidth = 8.57
Columns("E:E").EntireColumn.ColumnWidth = 8.57
Columns("F:F").EntireColumn.ColumnWidth = 8.57
Columns("G:G").EntireColumn.ColumnWidth = 2.14
Columns("H:H").EntireColumn.ColumnWidth = 8.57
Columns("I:I").EntireColumn.ColumnWidth = 8.57
Columns("J:J").EntireColumn.ColumnWidth = 8.57
Columns("K:K").EntireColumn.ColumnWidth = 8.57
Columns("L:L").EntireColumn.ColumnWidth = 8.57
Next Worksheet
End Sub
It appears to iterate through each worksheet based on display update but
only corrects the column widths on the active sheet at the time the code is
run. Can anyone advise how I force the code to carry out the instruction on
each sheet?
Thanks for any help.
number of workbooks each with a different number of sheets.
The code I have so far is:
For Each Worksheet In ActiveWorkbook.Worksheets
Columns("A:A").EntireColumn.ColumnWidth = 30.71
Columns("B:B").EntireColumn.ColumnWidth = 8.57
Columns("C:C").EntireColumn.ColumnWidth = 8.57
Columns("D").EntireColumn.ColumnWidth = 8.57
Columns("E:E").EntireColumn.ColumnWidth = 8.57
Columns("F:F").EntireColumn.ColumnWidth = 8.57
Columns("G:G").EntireColumn.ColumnWidth = 2.14
Columns("H:H").EntireColumn.ColumnWidth = 8.57
Columns("I:I").EntireColumn.ColumnWidth = 8.57
Columns("J:J").EntireColumn.ColumnWidth = 8.57
Columns("K:K").EntireColumn.ColumnWidth = 8.57
Columns("L:L").EntireColumn.ColumnWidth = 8.57
Next Worksheet
End Sub
It appears to iterate through each worksheet based on display update but
only corrects the column widths on the active sheet at the time the code is
run. Can anyone advise how I force the code to carry out the instruction on
each sheet?
Thanks for any help.