+ Reply to Thread
Results 1 to 8 of 8

Remember numbers in Textbox

  1. #1
    Registered User
    Join Date
    08-29-2010
    Location
    Copenhagen, Denmark
    MS-Off Ver
    Excel 2016
    Posts
    5

    Remember numbers in Textbox

    Hi
    I have a Textbox that draws a random number between 1 and 24. The code is shown here:

    Please Login or Register  to view this content.
    It works ok, but I would like to have it draw a number, that haven't been used before. When all 24 numbers have been drawn, I would like to reset the counter and start from scratch again.
    How can I do that?

    Regards Natkatten
    Last edited by natkatten; 01-02-2020 at 06:39 AM.

  2. #2
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Ipswich, England
    MS-Off Ver
    Office 365 (Win 10 - Work) & Office 365 Subscription Insider (Win 10 - Home)
    Posts
    35,885

    Re: Remember numbers in Textbox

    Administrative Note:

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!

    Forum Rules (updated September 2018): please read them here.
    How to use the Power Query code you've been given: help here. More about the Power suite here.
    Don't forget to say "thank you" to those who have helped you in your thread. If you wish, you can also reward them by clicking on their reputation star bottom left.

  3. #3
    Valued Forum Contributor saravnepali's Avatar
    Join Date
    01-14-2019
    Location
    Sydney Australia
    MS-Off Ver
    2010
    Posts
    313

    Re: Remember numbers in Textbox

    If you run it 24 times and want the textbox to be updated each time, you need a way for excel to remember what it had done before.

    A easy way to do that would be to save on the excel spreadsheet itself.

    So, I have two subs, one to generate 24 numbers and another to call them as needed.

    Please Login or Register  to view this content.
    If you think someone helped you, click on the "* Add Reputation" as a way to say thank you.

    If your problem is solved, go to Thread Tools and select Mark This Thread Solved

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013
    Posts
    15,571

    Re: Remember numbers in Textbox

    Please Login or Register  to view this content.

  5. #5
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    6,438

    Re: Remember numbers in Textbox

    Another option...
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere.....
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember......Mark Thread as Solved.
    Excel Forum Rocks!!!

  6. #6
    Registered User
    Join Date
    08-29-2010
    Location
    Copenhagen, Denmark
    MS-Off Ver
    Excel 2016
    Posts
    5

    Re: Remember numbers in Textbox

    Many thanks. I'll look at the suggestions later today.

  7. #7
    Registered User
    Join Date
    08-29-2010
    Location
    Copenhagen, Denmark
    MS-Off Ver
    Excel 2016
    Posts
    5

    Re: Remember numbers in Textbox

    Thanks again for the solutions. I used the one provided by Sintek.
    /natkatten

  8. #8
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    6,438

    Re: Remember numbers in Textbox

    Glad I could help...tx for rep +

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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