+ Reply to Thread
Results 1 to 3 of 3

Select Which Sheets To Print Via Checkboxes in Userform

Hybrid View

  1. #1
    jjward101
    Guest

    Select Which Sheets To Print Via Checkboxes in Userform

    Good Afternoon!

    I have a spreadsheet which gets updated often, and some sheets go to some people, others go to different people - al at different times.
    I would like to be able to select which sheets to print each time via check boxes in a userform (or a similar method) without having to print
    every page of every sheet.

    I have been able to find vba code that exports all of the sheets to a single pdf which is great.... but I am struggling to figure out how to
    implement a userform to select which sheets i am going to export each time.

    The code that I am using is below.....can anyone please assist me with figuring out how to accomplish what I am trying to do?

    Public Sub Save_Sheets_As_PDF()

    Dim PDFfile As String
    Dim currentSheet As Worksheet
    Dim I As Long
    Dim replaceSelected As Boolean
    Dim WS_Count As Integer
    Dim II As Integer
    PDFfile = CreateObject("WScript.Shell").SpecialFolders("Desktop") & "\" & "Flat Rate Pricing Book" & Format(Now, " DD-MMM-YY") & ".pdf"


    ' Set WS_Count equal to the number of worksheets in the active
    ' workbook.
    WS_Count = ActiveWorkbook.Worksheets.Count

    ' Begin the loop.
    For II = 1 To WS_Count

    ' Insert your code here.
    ' The following line shows how to reference a sheet within
    ' the loop by displaying the worksheet name in a dialog box.
    MsgBox ActiveWorkbook.Worksheets(II).Name

    Next II

    With ActiveWorkbook
    Set currentSheet = .ActiveSheet
    replaceSelected = True
    MsgBox .Sheets("Labor Calculator").Index + 2 & " " & .Sheets.Count
    For II = .Sheets("Labor Calculator").Index + 2 To .Sheets.Count
    .Sheets(II).Select replaceSelected
    replaceSelected = False
    Next
    .ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=PDFfile, _
    quality:=xlQualityMinimum, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=True
    currentSheet.Select True
    MsgBox "Your Price FIle Has Been Saved To Your Desktop! Go Sell Service!" & PDFfile
    End With

    End Sub


  2. #2
    Valued Forum Contributor rollis13's Avatar
    Join Date
    01-26-2012
    Location
    Cordenons
    MS-Off Ver
    Excel 2016 32bit - Win 11
    Posts
    935

    Re: Select Which Sheets To Print Via Checkboxes in Userform

    See if you can adapt for your use the code found in this old thread of this Forum: LINK
    Last edited by rollis13; 10-24-2021 at 01:18 PM.

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

    Re: Select Which Sheets To Print Via Checkboxes in Userform

    Attached is a simple version.
    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. [SOLVED] Userform Checkbox Controls Other Checkboxes in other sheets
    By jester113 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-28-2021, 07:03 PM
  2. Select sheets to Print Preview via Userform
    By cchen212 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-05-2017, 09:59 PM
  3. VBA Userform to select checkboxes and extract data based on their filter
    By sdhutty in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-25-2016, 09:03 AM
  4. Single Job Print - UserForm & CheckBoxes & Multiple WorkSheets
    By MajorDev in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-13-2016, 05:26 AM
  5. [SOLVED] Select checkboxes on a userform to save to PDF and e-mail
    By Kolein in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 09-22-2014, 10:45 AM
  6. Select series(lines) in a line graph by adding userform with checkboxes on a chart
    By aab_489 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-24-2014, 12:25 PM
  7. Print Sheets based on checkboxes in UserForm, Checkboxes also control another macro
    By krackaberr in forum Excel Programming / VBA / Macros
    Replies: 34
    Last Post: 03-05-2013, 11:12 AM

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