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
'
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
'