P
paris
I have a report than in certian cases if the person is above age 23 I want
excel to insert a page from another worksheet and print it in a certain
order. (ie sheet1 pages 1 to 7 then sheet 2 inserts a page at page 8 then
back to sheet 1 of pages 9 to 21)
here is my code
Sub PrintMultipages()
Sheet1.Activate
Dim age As Integer
age = Range("n10").Value
If age > 23 Then
With Sheets("sheets1")
..Pagesetup.PrintArea="A1:h309"
..Printout
end with
With Sheets("sheets2")
..Pagesetup.PrintArea="A1:h51"
..Printout
end with
With Sheets("sheets1")
..Pagesetup.PrintArea="A310:h911"
..Printout
end with
ElseIf age < 65 Then
Sheet1.PrintOut from:=1, to:=21
End If
End Sub
Problem is there is subscript error from "a1:h309" is there another way to
redefine this range or another code perhaps.
Thanks
excel to insert a page from another worksheet and print it in a certain
order. (ie sheet1 pages 1 to 7 then sheet 2 inserts a page at page 8 then
back to sheet 1 of pages 9 to 21)
here is my code
Sub PrintMultipages()
Sheet1.Activate
Dim age As Integer
age = Range("n10").Value
If age > 23 Then
With Sheets("sheets1")
..Pagesetup.PrintArea="A1:h309"
..Printout
end with
With Sheets("sheets2")
..Pagesetup.PrintArea="A1:h51"
..Printout
end with
With Sheets("sheets1")
..Pagesetup.PrintArea="A310:h911"
..Printout
end with
ElseIf age < 65 Then
Sheet1.PrintOut from:=1, to:=21
End If
End Sub
Problem is there is subscript error from "a1:h309" is there another way to
redefine this range or another code perhaps.
Thanks