+ Reply to Thread
Results 1 to 21 of 21

How to entering multiple pages from the message box

  1. #1
    Forum Contributor
    Join Date
    10-05-2014
    Location
    CALIFORNIA
    MS-Off Ver
    2010
    Posts
    1,667

    How to entering multiple pages from the message box

    Hi
    How do I enter a multiple pages when I get into the message box "Which page number needs to be printed?"

    I tried to enter i.e. 2, 4 so the page 2 and page 4 will print but unfortunately I did not print.

    Thank you

    Please Login or Register  to view this content.

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

    Re: How to entering multiple pages from the message box

    Hi RJ1969,

    Try the below, I have highlighted the changes in red

    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

  3. #3
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,570

    Re: How to entering multiple pages from the message box

    Please Login or Register  to view this content.
    Ben Van Johnson

  4. #4
    Forum Contributor
    Join Date
    10-05-2014
    Location
    CALIFORNIA
    MS-Off Ver
    2010
    Posts
    1,667

    Re: How to entering multiple pages from the message box

    HI

    Question to nkw83.

    I tried to type 1 to print one page in the input box but when it gets to Print Preview then the error message “Run Time Error '9'. Subscript out of range” appeared.
    Maybe I was entering it wrong when it’s a single page? :o(

    It works with 1;2 if I tried to print page 1 and page 2 and works with the print preview. No problem at all but if I do a single page then that is when I get the error.

    Thank you

    Please Login or Register  to view this content.

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

    Re: How to entering multiple pages from the message box

    I haven't thought about that but to overcome the error, you can simply type 1;1 or check the other solution provided by Ben

  6. #6
    Forum Contributor
    Join Date
    10-05-2014
    Location
    CALIFORNIA
    MS-Off Ver
    2010
    Posts
    1,667

    Re: How to entering multiple pages from the message box

    Ok.. Thank you so much.

    I do appreciate it :o)

  7. #7
    Forum Contributor
    Join Date
    10-05-2014
    Location
    CALIFORNIA
    MS-Off Ver
    2010
    Posts
    1,667

    Re: How to entering multiple pages from the message box

    Hi,

    I encountered another issue. When I tried to print 1;2;3;4 which a four pages in the worksheet Sheet2 it only prints page 1 and page 2 which it shows in the print preview.

    Please tell me what I need to do. Thank you.

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

    Re: How to entering multiple pages from the message box

    Since I don't have a sample file to try with, did you try the code posted by Ben in post #3 ? I think it'll do the job

  9. #9
    Forum Contributor
    Join Date
    10-05-2014
    Location
    CALIFORNIA
    MS-Off Ver
    2010
    Posts
    1,667

    Re: How to entering multiple pages from the message box

    Ok
    I tried ben. Here is the sample file.


    Thank you
    Attached Files Attached Files

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

    Re: How to entering multiple pages from the message box

    Quote Originally Posted by RJ1969 View Post
    I encountered another issue. When I tried to print 1;2;3;4 which a four pages ...
    If you wish to print from page 1 to 4, you should just put 1;4 (From 1 To 4) which is the default in excel. Unless you need to print non-consecutive pages, you need to make changes to your code to loop through the pages

  11. #11
    Forum Contributor
    Join Date
    10-05-2014
    Location
    CALIFORNIA
    MS-Off Ver
    2010
    Posts
    1,667

    Re: How to entering multiple pages from the message box

    Hi
    Ok i got it.

    For non consecutive pages, how do i change the code to loop the pages. Let say 1;3;7... pages.

    Please show me . Thanks

  12. #12
    Forum Contributor
    Join Date
    10-05-2014
    Location
    CALIFORNIA
    MS-Off Ver
    2010
    Posts
    1,667

    Re: How to entering multiple pages from the message box

    Question, if for any reason that I need to print a non consecutive number, do I always need to change the code to loop the pages? Is there anyway to avoid that? maybe add it in the code?
    Everything else is actually nice except when you mention about the non-consecutive which I did not think about it.

    Thanks.

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

    Re: How to entering multiple pages from the message box

    Try the below code ... You can either put 1-digit for one page like 3, or 2;4 for a range From & To or 1;4;2 for multiple pages

    Please Login or Register  to view this content.

  14. #14
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,570

    Re: How to entering multiple pages from the message box

    The code I posted handled random sheet numbers, but assumed they would be separated by commas in the textbox, not semi-colons. You just need to change these lines:
    Select Case InStr(pNr, ",")
    and
    pNr = Split(pNr, ",")

    replacing the commas with semi-colons.

  15. #15
    Forum Contributor
    Join Date
    10-05-2014
    Location
    CALIFORNIA
    MS-Off Ver
    2010
    Posts
    1,667

    Re: How to entering multiple pages from the message box

    Hi
    I want to say thank you to both of you for all the suggestion and providing me with the codes. Unfortunately, I tried the new codes and did not do what I was trying to accomplish.

    I attached the file. This workbook does exactly what I want to do. So, probably I will stick on this one.... sorry :o(
    ....... It's able to print single and consecutive page by enter 2;2 (single page) and 2;8 (consecutive page).
    ....... It's able to do the "print preview"
    ........ It's able to go directly to the printer properties so I can change the setting on it.

    My original workbook has several worksheets that has a lot of pages to print daily. The macro does help a lot so I want to thank you and I do appreciated everything you've done all.

    So, I am thinking ahead, what if I need to print "NON-CONSECUTIVE" in a later day... what would I do :o(
    If you can fix what I have in this attached file, I would really appreciate it.

    Thank you
    Attached Files Attached Files

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

    Re: How to entering multiple pages from the message box

    Quote Originally Posted by RJ1969 View Post
    what if I need to print "NON-CONSECUTIVE" in a later day... what would I do :o(
    If you can fix what I have in this attached file, I would really appreciate it
    Hi RJ1969,

    The code in post #13 functions as previous code but with the ability to print multiple non-consecutive pages. What happens with that code ? Does it give you any error ? Is there any unexpected behavior ?

    (The only thing I changed was to made you select the sheet by clicking any cell instead of typing the sheet name which can easily be changed if you wish)

  17. #17
    Forum Contributor
    Join Date
    10-05-2014
    Location
    CALIFORNIA
    MS-Off Ver
    2010
    Posts
    1,667

    Re: How to entering multiple pages from the message box

    Hi
    I tried to play around with it. It kinda work but Just the setting sequence are different. That is why I like ur old version settings.

    Yes, i wish to set the default to sheet2 and able just to change it if i can.

    These code are missing in it: Application.Dialogs(xlDialogPrint).Show
    and
    Application.Goto Sheets("Sheet2").Range("A2")

    The sequence supposed:
    1) Sheet2 - “which sheet do u want to print”
    2) “Which page number need to be printed”
    3) “Do u want to preview the page?” Yes/No
    4) How many printout of that page?” Yes/Cancel
    Set to 20 copies as default Please
    5) Then it goes to A2 in Sheet2.


    The sample file I sent thats what I actually wanted to happen


    Thank you so much

  18. #18
    Forum Contributor
    Join Date
    10-05-2014
    Location
    CALIFORNIA
    MS-Off Ver
    2010
    Posts
    1,667

    Re: How to entering multiple pages from the message box

    The sequence supposed:
    1) Sheet2 - “which sheet do u want to print”
    2) “Which page number need to be printed”
    3) “Do u want to preview the page?” Yes/No then when I click the “X” then
    4) How many printout of that page?” Yes/Cancel
    Set to 20 copies as default Please
    5) Then it goes to A2 in Sheet2 after printing

  19. #19
    Forum Contributor
    Join Date
    10-05-2014
    Location
    CALIFORNIA
    MS-Off Ver
    2010
    Posts
    1,667

    Re: How to entering multiple pages from the message box

    I forgot one thing:

    1) Sheet2 - “which sheet do u want to print”
    2) “Which page number need to be printed”
    3) “Do u want to preview the page?” Yes/No then when I click the “X” then

    The code: Application.Dialogs(xlDialogPrint).Show

    4) How many printout of that page?” Yes/Cancel
    Set to 20 copies as default Please
    5) Then it goes to A2 in Sheet2 after printing

  20. #20
    Forum Contributor
    Join Date
    10-05-2014
    Location
    CALIFORNIA
    MS-Off Ver
    2010
    Posts
    1,667

    Re: How to entering multiple pages from the message box

    Hi
    Check This out. I tried the new code. I try to set the sequence I wanted it. But, The print preview does not show. When I click the "yes" it skip the print preview before the print properties. Also, you said you can set it where I Sheet2 as a default and be able to over type it with other file name in the first box.

    Please check.... thank you.
    Attached Files Attached Files

  21. #21
    Forum Contributor
    Join Date
    10-05-2014
    Location
    CALIFORNIA
    MS-Off Ver
    2010
    Posts
    1,667

    Re: How to entering multiple pages from the message box

    Hi
    I will go ahead and put this one as "solved". I am actually good with the other code. Hopefully, I will be able to solve it someway.

    Thank you again.

+ 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] Message box after entering text in a cell
    By RJ1969 in forum Excel General
    Replies: 3
    Last Post: 04-14-2019, 05:25 PM
  2. Replies: 2
    Last Post: 09-29-2016, 10:49 AM
  3. How do I create a message box that only appears from some pages
    By djl295 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-29-2015, 05:46 PM
  4. automated pop up message when entering certain values to notify
    By pallie in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-13-2014, 06:03 AM
  5. Entering data on two seperate pages.
    By Biased Historian in forum Word Programming / VBA / Macros
    Replies: 1
    Last Post: 09-18-2011, 08:16 AM
  6. Excel 2007 : Print - Message Box to Select Pages - Help?
    By bkennedype in forum Excel General
    Replies: 1
    Last Post: 07-02-2011, 02:55 AM
  7. error message 91 when entering wrong data
    By eyesonly1965 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-13-2006, 11:22 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