printing specific pages

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
 
D

Doug Robbins - Word MVP

Better to post your question to microsoft.public.excel.programming. This
newsgroup is for questions relating to the use of VBA in Word.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top