+ Reply to Thread
Results 1 to 8 of 8

Macro for saving different sheets as a PDF

  1. #1
    Registered User
    Join Date
    07-14-2016
    Location
    Bangalore, India
    MS-Off Ver
    2013
    Posts
    28

    Macro for saving different sheets as a PDF

    Hello,

    I need help for the macro of a button and checkboxes.

    The macro for sheet 1 'Save' button, I've written so far is -
    Please Login or Register  to view this content.
    Now, need the same to be done for sheet1,sheet2, sheet 3 altogether for the same button.

    Checkbox 1 = Sheet 1
    Checkbox 2 = Sheet 2
    Checkbox 3 = Sheet 3

    Objective:

    Click 'Save' button, then save the corresponding sheets, based on the checkboxes selected in a
    single PDF (sheet 1 = Page 1 of PDF, sheet 2 = Page 2 of PDF, sheet 3 = Page 3 of PDF)

    Note: Also, need to ensure that the content of each sheet fits into one page!
    Attached Files Attached Files
    Last edited by anshul1719; 07-21-2016 at 07:48 AM.

  2. #2
    Forum Contributor
    Join Date
    07-01-2009
    Location
    Maine, USA
    MS-Off Ver
    Excel 2016
    Posts
    161

    Re: Macro for saving different sheets as a PDF

    It really helps to include a copy of your workbook.

    For starters, you reference a specific worksheet in your code (ProductRatingTool). To start with, you can begin with this link that shows how to export each worksheet to a PDF.

    You will need to add the following to ActiveSheet.PageSetup:

    Please Login or Register  to view this content.

    You will then need two IF statements. The first IF statement will need to see which checkboxes are checked. Without seeing your workbook, it's difficult to know which checkbox you're using. The other IF statement would modify your ProductRatingTool worksheet to how you have it configured in your code above.

  3. #3
    Registered User
    Join Date
    07-14-2016
    Location
    Bangalore, India
    MS-Off Ver
    2013
    Posts
    28

    Re: Macro for saving different sheets as a PDF

    I have added the attachment now.
    However, that's just sample one.

    How do I achieve the same here?

  4. #4
    Forum Contributor
    Join Date
    07-01-2009
    Location
    Maine, USA
    MS-Off Ver
    Excel 2016
    Posts
    161

    Re: Macro for saving different sheets as a PDF

    ??? Your workbook doesn't have the checkboxes you mentioned. Are you asking me to write the VBA for you instead? I'd prefer if you try yourself, and I'll help you as you need. This way you learn how yourself. Kind of like teaching a man to fish and and you feed him for a lifetime!

  5. #5
    Registered User
    Join Date
    07-14-2016
    Location
    Bangalore, India
    MS-Off Ver
    2013
    Posts
    28

    Re: Macro for saving different sheets as a PDF

    Please check the excel attached with the User form and all the codes.

  6. #6
    Registered User
    Join Date
    07-14-2016
    Location
    Bangalore, India
    MS-Off Ver
    2013
    Posts
    28

    Re: Macro for saving different sheets as a PDF

    I've updated the excel now and attached the correct one. Please check.
    Attached Files Attached Files

  7. #7
    Forum Contributor
    Join Date
    07-01-2009
    Location
    Maine, USA
    MS-Off Ver
    Excel 2016
    Posts
    161

    Re: Macro for saving different sheets as a PDF

    Now it makes more sense. Let me look at it a little while. I do have a question for you - when does the user press 'Button 2'? I'm curious because it could possibly be automated with an even trigger (such as on close).

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

    Re: Macro for saving different sheets as a PDF

    Maybe you can change this to your needs. If not, just delete it.
    Attached Files Attached Files

+ 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. Replies: 1
    Last Post: 08-14-2014, 09:50 PM
  2. Replies: 3
    Last Post: 07-26-2013, 01:39 AM
  3. [SOLVED] Macro to Saving Workbook Sheets as Separate Macro-Enabled Workbooks
    By puppetpalace in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-03-2013, 01:58 PM
  4. Replies: 4
    Last Post: 11-13-2012, 09:13 AM
  5. Replies: 13
    Last Post: 08-20-2012, 01:37 PM
  6. Renaming Active.Workbook and saving it without saving Macro
    By Djwill in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-04-2012, 03:09 AM
  7. Macro for saving / loading values between sheets
    By bell123 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-25-2011, 02:41 PM

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