Macro Print Range

  stus 19:54 29 Nov 07


I have a problem with a spreadsheet that I have inherited as my macro editing skills are poor.

I have had to add a few pages of data to the spreadsheet. However when I select the print button the original pages come out in a good format but the pages I have added come out on two pages and are therefore too small to read.

The macro is shown below. The first 34 pages are fine it is pages 35 - 38 that I have the problem with. Is it anything to do with the select case below? Or am I clutching at straws. Any help greatly appreciated

Sub PrintExcel()

frompage = InputBox("This consolidation pack contains a total of 36 pages. Please insert first page number to print:")
toPage = InputBox("Please insert past page number you wish to print:")
If IsNumeric(frompage) = False Or IsNumeric(toPage) = False Then Exit Sub

For i = 1 To 36
If i > frompage - 1 And i toPage + 1 Then
ActiveSheet.PageSetup.PrintArea = "print" & i

With ActiveSheet.PageSetup
.Zoom = False
.FitToPagesWide = 1
.FitToPagesTall = 1
.RightFooter = " "

End With
Select Case i
Case 34
With ActiveSheet.PageSetup
.Orientation = xlLandscape
End With
Case Else
With ActiveSheet.PageSetup
.Orientation = xlPortrait
End With
End Select
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True
End If
Next i

End Sub

  VoG II 19:58 29 Nov 07

You refer to pages 35 to 38 but your loop

For i = 1 To 36

only goes to 36. Could that be the problem?

This thread is now locked and can not be replied to.

Surface Pro (2017) vs Surface Pro 4

20 groundbreaking 3D animation techniques

How to mine Bitcoin on Mac