Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Old November 28th 05, 05:10 PM posted to microsoft.public.excel.setup
G
 
Posts: n/a
Default 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   Report Post  
Old November 28th 05, 05:56 PM posted to microsoft.public.excel.setup
G
 
Posts: n/a
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing a Link Mid-way Across Worksheets Frosty Excel Worksheet Functions 0 August 25th 05 12:03 AM
How do I save & apply sorts subtotals in excel to new worksheets? Kent Excel Discussion (Misc queries) 2 July 13th 05 12:53 AM
apply cell names to formulas in multiple worksheets BBurrows Excel Worksheet Functions 4 July 1st 05 05:35 PM
make custom header and footer in excel apply to all worksheets Alexandra Excel Discussion (Misc queries) 1 May 27th 05 06:11 PM
HELP! How do you--> Lock a set of rows but also link worksheets to FRUSTRATED Excel Discussion (Misc queries) 6 December 29th 04 10:05 PM


All times are GMT +1. The time now is 12:59 AM.

Powered by vBulletin® Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright 2004-2019 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"

 

Copyright © 2017