Results 1 to 3 of 3

Thread: Print Nth Worksheet To Mth Worksheet using VBA

  1. #1
    Member Ryan_Bernal's Avatar
    Join Date
    Dec 2012
    Posts
    37
    Rep Power
    0

    Print Nth Worksheet To Mth Worksheet using VBA

    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.
    Code:
    x= cmbListForm.List
    Worksheets("X").PrintOut Copies:=txtCopy.Value, from:txtFrom.Value, To:=txtTo.Value
    Here is my workbook.
    Attached Files Attached Files

  2. #2
    Member Ryan_Bernal's Avatar
    Join Date
    Dec 2012
    Posts
    37
    Rep Power
    0
    Guys, I already solve my own problem using this code.
    Thanks.
    Code:
    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

  3. #3
    Administrator Excel Fox's Avatar
    Join Date
    Mar 2011
    Posts
    1,401
    Rep Power
    10
    Thanks for posting Ryan
    A dream is not something you see when you are asleep, but something you strive for when you are awake.

    It's usually a bad idea to say that something can't be done.

    The difference between dream and aim, is that one requires soundless sleep to see and the other requires sleepless efforts to achieve

    Join us at Facebook

Similar Threads

  1. Trim all Cells in a Worksheet - VBA
    By Admin in forum Excel and VBA Tips and Tricks
    Replies: 6
    Last Post: 08-21-2015, 08:22 AM
  2. Replies: 7
    Last Post: 05-17-2013, 10:38 PM
  3. Replies: 2
    Last Post: 01-29-2013, 02:45 PM
  4. Combobox VBA update value worksheet
    By Tony in forum Excel Help
    Replies: 4
    Last Post: 10-28-2012, 12:28 AM
  5. Sort Worksheet by Color VBA
    By Admin in forum Excel and VBA Tips and Tricks
    Replies: 0
    Last Post: 10-25-2011, 02:25 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •