+ Reply to Thread
Results 1 to 20 of 20

How to print multiple pages from a vlookupset

  1. #1
    Registered User
    Join Date
    04-28-2021
    Location
    Hasselt, Belgium
    MS-Off Ver
    2019 professional
    Posts
    11

    Lightbulb How to print multiple pages from a vlookupset

    Hi, is there any way to assign a macro button so that when i click it it: print page 1 to page x according to the vlookup datasets?

    I have a datapage with all my clients. For each client I have to make an invoice which I compose with the VLookupfunction.
    Right now: I have to type client 15, change to the invoice page, press print and go back again to the first page, to start with nr 16.
    This takes a lot of time.

    I'm looking for a macro that lets me print the invoice of all clients between 15-45 for instance...

    I'm a total newbie in the world of macros and have but a little knowledge of excel :-)



    Thx for the help

    Pablo1976

  2. #2
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: How to print multiple pages from a vlookupset

    Hi Pablo1976,

    You can use a loop to do such thing, post a copy of your file but remove all sensitive data but keep the file structure & format to provide you with the proper code ...
    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    04-28-2021
    Location
    Hasselt, Belgium
    MS-Off Ver
    2019 professional
    Posts
    11

    Re: How to print multiple pages from a vlookupset

    Hi Nankw83

    Thx for wanting to take a look at this. Already takes me a long time...
    Always difficult when youre new at things...

    Anywho you should be able to see the file...
    Attached Files Attached Files

  4. #4
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: How to print multiple pages from a vlookupset

    Try this based on your sample file ...
    Please Login or Register  to view this content.
    If I was able to help, you can thank me by clicking the * Add Reputation under my user name

  5. #5
    Registered User
    Join Date
    04-28-2021
    Location
    Hasselt, Belgium
    MS-Off Ver
    2019 professional
    Posts
    11

    Re: How to print multiple pages from a vlookupset

    Ok thx I managed to run the macro.

    It printed 10 pages, but they were all the same clients invoice, times 10.
    I would of course need the invoice of each client, one time only.

    Second question: this macro prints all items in the list. Can you adjust the code that you can print from client 15-23 for instance...

    Grtz

    Pablo1976

  6. #6
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: How to print multiple pages from a vlookupset

    Try below code ... Assuming the code should enter the client number in cell A22
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    04-28-2021
    Location
    Hasselt, Belgium
    MS-Off Ver
    2019 professional
    Posts
    11

    Re: How to print multiple pages from a vlookupset

    Ok, this seems to have done its job ! Wow, this is going to save me lots of time :-)

    Thx a lot NanKW83 for your time and effort

  8. #8
    Forum Expert nankw83's Avatar
    Join Date
    08-31-2015
    Location
    Kuwait
    MS-Off Ver
    365
    Posts
    1,712

    Re: How to print multiple pages from a vlookupset

    Glad to help & thanks for the Rep+

    If that takes care of your question, please take a moment & mark this thread as [SOLVED] from the Thread Tools above your first post

  9. #9
    Registered User
    Join Date
    04-28-2021
    Location
    Hasselt, Belgium
    MS-Off Ver
    2019 professional
    Posts
    11

    Arrow Re: How to print multiple pages from a vlookupset

    I have an additional question to this thread...

    Earlier on I wanted a formula that would allow me to print a number of documents using a vlookup function. Works like a charm, still use it todat...


    Sub test()

    txt$ = InputBox("Enter # From & To separated by - like below" & vbLf & "1-5")

    For x& = Split(txt, "-")(0) To Split(txt, "-")(1)
    Sheets("Blad1").[A59].Value = x
    Sheets("Factuur Voorbeeld").PrintOut
    Next

    End Sub


    My question: would it also be possible to 'print' these documents to pdf (instead of on paper). Each page would have to be a seperate pdf...

    I presume this will be easy for you guys but I'm not very into coding (not at all really) and can't seem to find the necessary info online...

    Thx in advance

  10. #10
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,516

    Re: How to print multiple pages from a vlookupset

    If you change this
    Please Login or Register  to view this content.
    to This
    Please Login or Register  to view this content.
    Does that do what you want? Change references like folder name etc as required

    https://www.snb-vba.eu/index_en.html
    Je noorderbuurman heeft een goede site.
    Last edited by jolivanes; 03-13-2023 at 01:53 PM.
    Experience trumps academics every day of the week and twice on Sunday.

  11. #11
    Registered User
    Join Date
    04-28-2021
    Location
    Hasselt, Belgium
    MS-Off Ver
    2019 professional
    Posts
    11

    Arrow Re: How to print multiple pages from a vlookupset

    Jolivanes: No, this doesn't seem to work. I get an errormessage, saying there's no connection to my printer??
    Are you sure the syntaxis is right??

  12. #12
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,516

    Re: How to print multiple pages from a vlookupset

    Do you have "Microsoft Print to PDF" installed?
    And yes, it works here.

  13. #13
    Registered User
    Join Date
    04-28-2021
    Location
    Hasselt, Belgium
    MS-Off Ver
    2019 professional
    Posts
    11

    Re: How to print multiple pages from a vlookupset

    Ok, you were right about that one. I forgot to change the settings to 'print to pdf' :-D

    Changed that for now, but it still doesn't seem to work.
    When I press run, it seems like the program is rendering the pdffiles at first. But when I go to look in this map C:/pablo there's no files there.
    I've searched for new .pdffiles on the disk but they're nowhere to be found...

    Any ideas?

  14. #14
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,516

    Re: How to print multiple pages from a vlookupset

    Do you have a folder named "Pablo" or "pablo"?
    That name should be changed to an existing folder name.

  15. #15
    Registered User
    Join Date
    04-28-2021
    Location
    Hasselt, Belgium
    MS-Off Ver
    2019 professional
    Posts
    11

    Re: How to print multiple pages from a vlookupset

    The name of the folder where to put the files is the same as in the code.

    Still doens't work... I have a feeling I'm overlooking a very simple thing...

  16. #16
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,516

    Re: How to print multiple pages from a vlookupset

    Show us the code, all of it, that does not work.
    I assume that the names are all properly checked. All exactly the same?

  17. #17
    Registered User
    Join Date
    04-28-2021
    Location
    Hasselt, Belgium
    MS-Off Ver
    2019 professional
    Posts
    11

    Re: How to print multiple pages from a vlookupset

    Ok this is the code:

    Sub test()

    txt$ = InputBox("Enter # From & To separated by - like below" & vbLf & "1-5")

    For x& = Split(txt, "-")(0) To Split(txt, "-")(1)
    Sheets("Blad1").[A75].Value = x
    Sheets("Factuur Voorbeeld").PrintOut , , , , , True, , "C:\Pablo" & x & ".PDF"
    Next

    End Sub



    I've put the settings to print to pdf. And A75 in the above code is the correct value.

    .... when I run it, it seems to take the time to compile the requested files. But when I look in the folder C:\Pablo there are no files to be found ??
    I dunno what's wrong, it has to be something very easy...

  18. #18
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,516

    Re: How to print multiple pages from a vlookupset

    This
    Please Login or Register  to view this content.
    needs a backslash like so
    Please Login or Register  to view this content.
    This works as you want as far as I can see.
    Check references and change if required.
    Please Login or Register  to view this content.
    Last edited by jolivanes; 03-19-2023 at 06:12 PM.

  19. #19
    Registered User
    Join Date
    04-28-2021
    Location
    Hasselt, Belgium
    MS-Off Ver
    2019 professional
    Posts
    11

    Re: How to print multiple pages from a vlookupset

    @Jolivanes: Finally got it working today. Which is super, thx for all the help, wouldn't have worked without you :-)

  20. #20
    Forum Expert
    Join Date
    10-06-2008
    Location
    Canada
    MS-Off Ver
    2007 / 2013
    Posts
    5,516

    Re: How to print multiple pages from a vlookupset

    Good to hear that you have it working.
    Thanks for the update and good luck.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Print Macro for multiple but different print pages of the same sheet
    By dgarrod in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-18-2017, 02:55 PM
  2. Replies: 1
    Last Post: 03-24-2016, 05:28 PM
  3. [SOLVED] Print multiple pages with different name.
    By Annepaws in forum Excel General
    Replies: 2
    Last Post: 06-20-2014, 02:08 PM
  4. [SOLVED] CheckBoxs to print multiple pages
    By nighttrainrex in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-12-2012, 08:32 PM
  5. Print multiple pages on one page
    By endear in forum Excel General
    Replies: 1
    Last Post: 05-04-2012, 09:13 AM
  6. [SOLVED] Print multiple pages from the Slicer
    By JimDandy in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-04-2012, 11:28 AM
  7. Print multiple pages to PDF Macro
    By CJ-22 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 01-19-2011, 06:28 PM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1