+ Reply to Thread
Results 1 to 10 of 10

Automatically answer InputBox

  1. #1
    Registered User
    Join Date
    06-27-2009
    Location
    USA, PA
    MS-Off Ver
    Excel 2003
    Posts
    10

    Automatically answer InputBox

    Hi.
    Please help me to modify the code.
    There are random numbers in B2:U20 needed to be shuffled.
    First my macro runs SelRange, it selects B2:U20. Next it runs Shuffle where a message box pop ups.
    I need the button "OK" to be pressed automatically. How is it possible?
    Thanks.





    Please Login or Register  to view this content.
    Last edited by rnd37; 10-16-2012 at 02:03 AM.

  2. #2
    Valued Forum Contributor
    Join Date
    08-14-2012
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    573

    Re: Automatically answer InputBox

    Hi, check this link. It got code for timed message box. http://www.excelforum.com/excel-gene...-response.html

  3. #3
    Registered User
    Join Date
    06-27-2009
    Location
    USA, PA
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: Automatically answer InputBox

    Thank for response. I checked the link. It's about how to ignore a message box but I need the button "OK" to be pressed.
    Any ideas anyone?

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Automatically answer InputBox

    Which message box is it?

  5. #5
    Registered User
    Join Date
    06-27-2009
    Location
    USA, PA
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: Automatically answer InputBox

    Actually it an InputBox pop ups.
    If you paste the code you will see. One module with SelRange and the rest in second module.
    The InputBox appears already with needed range taken from selection (Default)
    For case if nothing entered the code says " If r Is Nothing Then Exit Sub"
    I think I need to add "Else" statement to continue to run sub. Am I right?

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Automatically answer InputBox

    What exactly are you trying to do?

    If you don't want the inputbox why is it in the code?

  7. #7
    Registered User
    Join Date
    06-27-2009
    Location
    USA, PA
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: Automatically answer InputBox

    I'm trying to shuffle numbers in the range.
    Why inputbox? Because I found that code which does the job but someone created it with an inputbox.
    I'd prefer it without where the range to shuffle would be in the code. Or another way is to confirm the inputbox without user intervention.
    It's important because the main macro opens a lot of workbooks and applies that sub Shuffle hundreds times.

  8. #8
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Automatically answer InputBox

    If you don't want the inputbox remove it from the code.

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    06-27-2009
    Location
    USA, PA
    MS-Off Ver
    Excel 2003
    Posts
    10

    Re: Automatically answer InputBox

    Works perfect, thanks!

  10. #10
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Automatically answer InputBox

    @ rnd37

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Also, as an infrequent user of the forum, you may have forgotten (or may not be aware) that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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