Excel vba help needed

P

prakash

Hi everybody ,

iam new to excel vba development i have a problem ,any one can help
me to sort this out
Scenario:
I have a workbook with 40 worksheets and i want to printout 15 sheets
out of 40 with a common range eg( A10 to C30)

i have to do it using vba with a command button ( it have to select
those 15 pages )and i have to invoke a xldailogprint to choose the
printer to print only those 15 pages
thanks in advance ,
regards,
prakash.
 
M

Martin Fishlock

Prakesh

Try this changing the r1 as required:

Sub printsheets()
Const r1 As String = "C6:E12" ' range to print
Const r0 As String = ""
Dim s
Dim si
s = Array("All Bus Models", "Sheet5") ' sheets to print
For Each si In s ' set print area
Worksheets(si).PageSetup.PrintArea = r1
Next si
Sheets(s).PrintOut Copies:=1, Collate:=True
For Each si In s ' clear print area
Worksheets(si).PageSetup.PrintArea = r0
Next si
End Sub
 

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