Hi All,
I have a series of spreadsheets that have a different number of worksheets in them what i'm looking to do is a loop that sets the first sheet to Portrait and the rest to landscape also sheets 2 onwards need to fit to 1 page wide but as many multiple pages as needed I have used 15 in the wxample below with the first line repeated on each page.
This code excludes the loop code as this is what i'm having difficulty with would it need to be just 1 loop or a loop just for the second sheet onwards if so how would I do this. The first sheet is always called summary.
Here goes the code that I autorecorded and took out the stuff i didnt think i needed hope i havent taken out any thing that i needed.
Sub Landport()
'
' Land_port Macro
'
'
Sheets(1).Select
With ActiveSheet.PageSetup
.PrintTitleRows = "$1:$1"
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.Orientation = xlPortrait
End With
Sheets(2).Select
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.Orientation = xlLandscape
End With
With ActiveSheet.PageSetup
.PrintTitleRows = "$1:$1"
.PrintTitleColumns = ""
End With
With ActiveSheet.PageSetup
.FitToPagesWide = 1
.FitToPagesTall = 15
End With
Sheets(3).Select
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.Orientation = xlLandscape
End With
With ActiveSheet.PageSetup
.PrintTitleRows = "$1:$1"
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.FitToPagesWide = 1
.FitToPagesTall = 15
End With
End Sub
If anyone can help with this it would be appreciated.
Regards
Paul
I have a series of spreadsheets that have a different number of worksheets in them what i'm looking to do is a loop that sets the first sheet to Portrait and the rest to landscape also sheets 2 onwards need to fit to 1 page wide but as many multiple pages as needed I have used 15 in the wxample below with the first line repeated on each page.
This code excludes the loop code as this is what i'm having difficulty with would it need to be just 1 loop or a loop just for the second sheet onwards if so how would I do this. The first sheet is always called summary.
Here goes the code that I autorecorded and took out the stuff i didnt think i needed hope i havent taken out any thing that i needed.
Sub Landport()
'
' Land_port Macro
'
'
Sheets(1).Select
With ActiveSheet.PageSetup
.PrintTitleRows = "$1:$1"
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.Orientation = xlPortrait
End With
Sheets(2).Select
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.Orientation = xlLandscape
End With
With ActiveSheet.PageSetup
.PrintTitleRows = "$1:$1"
.PrintTitleColumns = ""
End With
With ActiveSheet.PageSetup
.FitToPagesWide = 1
.FitToPagesTall = 15
End With
Sheets(3).Select
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.Orientation = xlLandscape
End With
With ActiveSheet.PageSetup
.PrintTitleRows = "$1:$1"
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.FitToPagesWide = 1
.FitToPagesTall = 15
End With
End Sub
If anyone can help with this it would be appreciated.
Regards
Paul