+ Reply to Thread
Results 1 to 4 of 4

Print selected ranges from UserForm

  1. #1
    Registered User
    Join Date
    08-17-2009
    Location
    Ukraine
    MS-Off Ver
    Excel 2010
    Posts
    46

    Question Print selected ranges from UserForm

    Hi again,

    I've got a "Clients" sheet, where I have client data. Sometimes I just need to printout the phone numbers, or just the addresses etc.

    So I made this user form where I have check boxes to choose.

    For example :

    If the check box 1 is selected, the range to print will be : Range("A8:A100")
    If the check box 2 is selected, the range to print will be : Range("K8:K100")

    if the check box 1 is selected with check box 2 , then ranges will be Range("A8:A100, K8:K100)

    and so on

    I wrote this so far :

    Please Login or Register  to view this content.
    But I can not figure out how to deal with the IF conditions.

    If checkbox1.value = true then..... what ?

    thank you in advance!

  2. #2
    Valued Forum Contributor Neil_'s Avatar
    Join Date
    04-19-2013
    Location
    Yorkshire
    MS-Off Ver
    Office 365 Enterprise E3 2013 / 2016
    Posts
    479

    Re: Print selected ranges from UserForm

    A check box only returns true or false (unless you've enabled triple state), so
    .value = true
    may be omitted.

    Please Login or Register  to view this content.
    Last edited by Neil_; 09-12-2016 at 12:01 PM.
    Frob first, tweak later

  3. #3
    Valued Forum Contributor Neil_'s Avatar
    Join Date
    04-19-2013
    Location
    Yorkshire
    MS-Off Ver
    Office 365 Enterprise E3 2013 / 2016
    Posts
    479

    Re: Print selected ranges from UserForm

    By the way, don't think the print area will work with multiple selections, you may need to hide all columns , then unhide the range instead. I'll change the code.

    just tested, no, it prints on seperate pages.
    Last edited by Neil_; 09-12-2016 at 11:52 AM.

  4. #4
    Valued Forum Contributor Neil_'s Avatar
    Join Date
    04-19-2013
    Location
    Yorkshire
    MS-Off Ver
    Office 365 Enterprise E3 2013 / 2016
    Posts
    479

    Re: Print selected ranges from UserForm

    Edited my first post with correct code
    Last edited by Neil_; 09-12-2016 at 12:00 PM.

+ 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] Print from Userform with Selected Printer
    By indub in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 05-18-2017, 11:05 AM
  2. [SOLVED] Send only Ranges selected with Userform - Not the entire sheet
    By JJFletcher in forum Excel Programming / VBA / Macros
    Replies: 26
    Last Post: 06-12-2016, 07:32 AM
  3. VBA Userform: Add selected userform value to selected any cell
    By nimesh29 in forum Hello..Introduce yourself
    Replies: 2
    Last Post: 08-06-2014, 09:14 PM
  4. Set print area of selected range then print preview if ok then print the document!
    By HaroonSid in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-01-2014, 07:10 AM
  5. Code and Formula to print dynamic print area ranges
    By stpeter in forum Excel General
    Replies: 1
    Last Post: 10-15-2013, 03:33 PM
  6. Activate Print option with a userform where selected Sheet check box option available..
    By santosh226001 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-03-2013, 08:19 AM
  7. Display a UserForm based on Data selected in another UserForm's ListBox
    By RPhilbin83 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-26-2011, 11:35 AM

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