ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel vba help needed (https://www.excelbanter.com/excel-programming/378049-excel-vba-help-needed.html)

prakash

Excel vba help needed
 
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.


Martin Fishlock

Excel vba help needed
 
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

--
Hope this helps
Martin Fishlock


"prakash" wrote:

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.




All times are GMT +1. The time now is 05:14 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com