Print a invoice

  • I made a macro to print the Invoice worksheet and I added a button to run the macro but I don't think I did it correctly. I would appreciate any help you could give me.

    Code
    1. Sub Print_Invoice()
    2. '
    3. ' Print_Invoice Macro
    4. '
    5. ' Keyboard Shortcut: Ctrl+p
    6. '
    7. Range("A1:G35").Select
    8. Selection.PrintOut Copies:=1, Collate:=True
    9. End Sub


    This is the information I used for the command button:


    Private Sub CommandButton1_Click()
    Range("A2:G34").Select
    Selection.PrintOut Copies:=1, Collate:=True
    End Sub

  • Re: Print a invoice


    Quote from wanita

    I made a macro to print the Invoice worksheet and I added a button to run the macro but I don't think I did it correctly. I would appreciate any help you could give me.


    The code should be OK. But give some more information:


    - Do you get an error?
    - Is there anything happening at all?
    - What if you add


    Msgbox "Hello"


    right as the first line of code?


    - ...


    Wigi

    Regards,


    Wigi


    Excel MVP 2011-2014


    For more Excel memes: visit http://www.wimgielis.com ==> English articles ==> Excel memes


    -- Topics without [CODE] tags or a meaningful topic title, will be neglected by me (and probably many others as well) --

  • Re: Print a invoice


    Quote from wanita

    The form prints but I wanted to make sure I was using the correct format.


    What do you mean with format?

    Regards,


    Wigi


    Excel MVP 2011-2014


    For more Excel memes: visit http://www.wimgielis.com ==> English articles ==> Excel memes


    -- Topics without [CODE] tags or a meaningful topic title, will be neglected by me (and probably many others as well) --

  • Re: Print a invoice


    Duplicate post


    Is this what you want? You might ant to set the number of copies to 2 - one for customer, 1 for filing.

    Code
    1. Sub Print_Invoice()
    2. '
    3. ' Print_Invoice Macro
    4. '
    5. ' Keyboard Shortcut: Ctrl+p
    6. '
    7. Range("A1:G35").PrintOut Copies:=1, Collate:=True
    8. End Sub