Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.setup
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.setup
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Changing a Link Mid-way Across Worksheets | Excel Worksheet Functions | |||
How do I save & apply sorts subtotals in excel to new worksheets? | Excel Discussion (Misc queries) | |||
apply cell names to formulas in multiple worksheets | Excel Worksheet Functions | |||
make custom header and footer in excel apply to all worksheets | Excel Discussion (Misc queries) | |||
HELP! How do you--> Lock a set of rows but also link worksheets to | Excel Discussion (Misc queries) |