PDA

View Full Version : Print Nth Worksheet To Mth Worksheet using VBA



Ryan_Bernal
02-26-2013, 05:30 PM
I want to create vba code that will print the specific Worksheet, From - To,No. of Copies.
I have 3 textboxes and 1 combobox.
1.txtFrom
2.txtTo
3.txtCopy
4.cmbListForm

My Combobox List Down the Forms.
I've search code but i don't know how to execute this.


x= cmbListForm.List
Worksheets("X").PrintOut Copies:=txtCopy.Value, from:txtFrom.Value, To:=txtTo.Value

Here is my workbook.

Ryan_Bernal
02-28-2013, 11:14 AM
Guys, I already solve my own problem using this code.
Thanks.


Private Sub CommandButton2_Click()
Dim form As String
form = cmbForm.Value

If txtFrom.Value = "" Then
MsgBox "Type Start Page"

ElseIf txtTo.Value = "" Then
MsgBox "Type End Page"

ElseIf txtCopy.Value = "" Then
MsgBox "Type Number of Copies"

Else
Worksheets(form).PrintOut Preview:=True, From:=txtFrom.Value, To:=txtTo.Value, Copies:=txtCopy.Value
End If
End Sub

Excel Fox
02-28-2013, 06:57 PM
Thanks for posting Ryan