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
txtFrom - start point of the pages to be printed
txtTo -end point of the pages to be printed
cmbForm- combo box that list down forms
Print button to print the form
I just want to know what is wrong in my code.
Here if the photo of worksheet. (cannot upload excel files)
Attachment 97071
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
txtFrom - start point of the pages to be printed
txtTo -end point of the pages to be printed
cmbForm- combo box that list down forms
Print button to print the form
I just want to know what is wrong in my code.
Code:
Option Explicit
Private Sub CommandButton1_Click()
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 SubAttachment 97071