Won't apply to all worksheets
This macro will only work on the selected worksheet. It will not
automatically apply to all worksheets in the workbook. How do I make this macro work on all worksheets? Thanks! Sub C_Page_Layout() Dim wks As Worksheet Application.ScreenUpdating = False For Each wks In ActiveWorkbook.Worksheets Columns("A:A").Select Selection.EntireColumn.Hidden = True Columns("B:B").Select With Selection .ColumnWidth = 20 .HorizontalAlignment = xlLeft End With Rows("1:1").Select With Selection .Interior.ColorIndex = xlNone .Font.Bold = True .Rows.AutoFit .HorizontalAlignment = xlCenter End With Next wks End Sub |
Won't apply to all worksheets
I fixed the problem...took out selection and replaced with wks.
"G" wrote: This macro will only work on the selected worksheet. It will not automatically apply to all worksheets in the workbook. How do I make this macro work on all worksheets? Thanks! Sub C_Page_Layout() Dim wks As Worksheet Application.ScreenUpdating = False For Each wks In ActiveWorkbook.Worksheets Columns("A:A").Select Selection.EntireColumn.Hidden = True Columns("B:B").Select With Selection .ColumnWidth = 20 .HorizontalAlignment = xlLeft End With Rows("1:1").Select With Selection .Interior.ColorIndex = xlNone .Font.Bold = True .Rows.AutoFit .HorizontalAlignment = xlCenter End With Next wks End Sub |
All times are GMT +1. The time now is 09:47 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com