+ 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
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    79,365

    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!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

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

    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 O.365
    Posts
    22,464

    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
    13,122

    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
    13,122

    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)

Similar Threads

  1. [SOLVED] Highlight textbox if date <=60 days referencing an array as textbox numbers
    By nigelog in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 03-23-2017, 11:43 AM
  2. [SOLVED] How to get increasing numbers in a textbox
    By ImranBhatti in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 04-09-2016, 03:41 AM
  3. [SOLVED] Remember text in next textbox
    By minifreak in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-24-2012, 09:23 AM
  4. Numbers in textbox appear as hh:mm in sheet
    By tim5 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-04-2011, 05:06 AM
  5. How can i show Row Numbers in the TextBox
    By L_ter in forum Word Formatting & General
    Replies: 1
    Last Post: 04-21-2009, 07:19 AM
  6. [SOLVED] Format numbers in Textbox
    By stickandrock in forum Excel General
    Replies: 1
    Last Post: 10-04-2005, 04:05 PM
  7. Only numbers in a textbox
    By abxy in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-14-2005, 02:51 PM

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