• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Print Worksheet Using Excel VBA

Ryan_Bernal

New Member
Hello!

Good Day!

I am new in excel Vba.

i want to use excel vba to print worksheets.

I have "View" sheet w/c my userform located, Form1 and Form2 sheets w/c to be printed.

My userform is:

txtCopy - no of copies to be printed on chosen form

txtFrom - start point of the pages to be printed on chosen form

txtTo -end point of the pages to be printed on chosen form

cmbForm- combo box that list down forms

Print button to print the form.

I just want to know what is wrong in my code. (variable not define)

Here's my Code

'

Sub Print_Form()

Dim x As Integer, y As Integer, z As Integer, form As String

form = cmbForm.Value

x = txtFrom.Value

y = txtTo.Value

Worksheets(form).PrintOut From:=x, To:=y, Copies:=z

End Sub

'
 
Ryan


Can you post your file for us to review?

Refer: http://chandoo.org/forums/topic/posting-a-sample-workbook
 
Back
Top