B
bestie
Hi,
Im new to the whole Macro VB thing and have been having problems with the
following piece of code. What I am trying to do is make changes to the page
set up of a dozen sheets in a workbook. The sheets I want to change the set
up of are listed of a workbook sheet called Tree and are in cells G9 to G30.
I tried recording a macro selecting these sheets however when I ran it only
the first sheet changed, can someone please help me or advise me of a better
way of doing this..
Thanks
Sub grid()
'
' grid Macro
' Macro recorded 27/07/2006 by Windows User
'
'
Dim i As Long
Dim nRow As Long
Dim Sname$
' selects each sheet name down the list & activates that sheet
i = 9
With Sheets("TREE")
Do While Not IsEmpty(.Cells(i, "G").Value)
Sname$ = Cells(i, "G")
' passes the sheet name to a routine that executes more code on
the named sheet
Sname.Select
.LeftHeader = "&""Arial,Bold ""&12 JUNE" & Chr(10) & ""
.CenterHeader = _
"&""Arial,Regular""&10 Income && Expenditure FY End 2007- Trust Total
"
.RightHeader = "&""Arial,Bold ""&12 YTD To Period 004"
.LeftFooter = "&""Arial,Regular""&10 RSC - Printed 08:40 /
27/07/2006"
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.15748031496063)
.RightMargin = Application.InchesToPoints(0.15748031496063)
.TopMargin = Application.InchesToPoints(0.590551181102362)
.BottomMargin = Application.InchesToPoints(0.590551181102362)
.HeaderMargin = Application.InchesToPoints(0)
.FooterMargin = Application.InchesToPoints(0)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintInPlace
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperA4
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
.PrintErrors = xlPrintErrorsDisplayed
i = i + 1
Loop
End With
Im new to the whole Macro VB thing and have been having problems with the
following piece of code. What I am trying to do is make changes to the page
set up of a dozen sheets in a workbook. The sheets I want to change the set
up of are listed of a workbook sheet called Tree and are in cells G9 to G30.
I tried recording a macro selecting these sheets however when I ran it only
the first sheet changed, can someone please help me or advise me of a better
way of doing this..
Thanks
Sub grid()
'
' grid Macro
' Macro recorded 27/07/2006 by Windows User
'
'
Dim i As Long
Dim nRow As Long
Dim Sname$
' selects each sheet name down the list & activates that sheet
i = 9
With Sheets("TREE")
Do While Not IsEmpty(.Cells(i, "G").Value)
Sname$ = Cells(i, "G")
' passes the sheet name to a routine that executes more code on
the named sheet
Sname.Select
.LeftHeader = "&""Arial,Bold ""&12 JUNE" & Chr(10) & ""
.CenterHeader = _
"&""Arial,Regular""&10 Income && Expenditure FY End 2007- Trust Total
"
.RightHeader = "&""Arial,Bold ""&12 YTD To Period 004"
.LeftFooter = "&""Arial,Regular""&10 RSC - Printed 08:40 /
27/07/2006"
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.15748031496063)
.RightMargin = Application.InchesToPoints(0.15748031496063)
.TopMargin = Application.InchesToPoints(0.590551181102362)
.BottomMargin = Application.InchesToPoints(0.590551181102362)
.HeaderMargin = Application.InchesToPoints(0)
.FooterMargin = Application.InchesToPoints(0)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintInPlace
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperA4
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
.PrintErrors = xlPrintErrorsDisplayed
i = i + 1
Loop
End With