+ Reply to Thread
Results 1 to 4 of 4

Print a range in a worksheet using a UserForm button

  1. #1
    Registered User
    Join Date
    12-08-2019
    Location
    uk
    MS-Off Ver
    2010
    Posts
    2

    Print a range in a worksheet using a UserForm button

    Hi, Print from user form cmdPrint The print range I need is from sheet "Data", displayed in vb listbox (OutputBox) is from "N10:V10" down to any row to "N9955:V9955 depending on results of various searches.
    Hope this makes sense. Very new and have muddled my way thru this far.
    Edit: Removed sensitive data and attached the file in the hope of getting some help.

    Thank You
    Attached Files Attached Files
    Last edited by alincodx70; 12-08-2019 at 03:34 PM. Reason: Added worksheet

  2. #2
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Print a range in a worksheet using a UserForm button

    The file self destructs when attempting to allow editing. You need to disable the autorun macros and then upload the file.
    Any code provided by me should be tested on a copy or a mock up of your original data before applying it to the original. Some events in VBA cannot be reversed with the undo facility in Excel. If your original post is satisfied, please mark the thread as "Solved". To upload a file, see the banner at top of this page.
    Just when I think I am smart, I learn something new!

  3. #3
    Registered User
    Join Date
    12-08-2019
    Location
    uk
    MS-Off Ver
    2010
    Posts
    2

    Re: Print a range in a worksheet using a UserForm button

    Hi thanks for the reply. Yes I understand. I posted a copy so no problem. Trying to find my way around this forum. Should I be searching somewhere for a file from you?
    Regards
    Edit: Use the "HIDE" button bottom right of the form to close the form!
    Last edited by alincodx70; 12-08-2019 at 06:33 PM.

  4. #4
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Print a range in a worksheet using a UserForm button

    Well, I got the file open and took a look at it compared to the OP. I did not see anything in OutputBox, I don't want to spend a lot of time analyzing your entire project just to print a range from a sheet. Here is the gist of what you would need to print a variable range when only the starting row is known.
    Please Login or Register  to view this content.
    Depending on what is actually in the listbox, you might be able to use variables instead of hard coding the sheet and range parameters into the code, but like I said, there was nothing in the OutputBox control so I am not sure what you would be working with data wise to set up the variables. If the data always comes from the same sheet then that would allow you to use the sh variable as it is now. But if it varies and the sheet is identified somehow in the listbox then you would have to reference the listbox value to set the sheet variable. Same with the range parameters, thay would need to be initialized using listbox values. But at this point I am not sure how that would be done.
    Last edited by JLGWhiz; 12-09-2019 at 09:45 AM.

+ 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] Button To Print Specific cell Range On One Sheet In Print Selection
    By diddy47 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-03-2020, 06:23 AM
  2. 2 problems with creating a print button on a userform
    By manuhuyghe in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-01-2014, 02:37 AM
  3. Print button in userform's title bar
    By mani_bbc05 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-03-2013, 04:36 PM
  4. Print Button to print UserForm for multi-sheet
    By smartcard in forum Excel General
    Replies: 12
    Last Post: 04-29-2010, 07:47 AM
  5. Print button to print userform
    By jcarstens in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-20-2009, 08:18 PM
  6. Print a PDF document from Userform Command Button
    By msommerf in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-20-2009, 12:38 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