+ Reply to Thread
Results 1 to 9 of 9

Number Generation

  1. #1
    Registered User
    Join Date
    12-06-2019
    Location
    Sri Lanka
    MS-Off Ver
    2016
    Posts
    7

    Number Generation

    Hi Guys,

    Can anybody help me to write up a formula to generate a number which will display a number from 1 to 10 every 30 seconds ?
    number should display in ascending order at a time, which will change to next after 30 seconds.

    Regards
    Dilan

  2. #2
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,662

    Re: Number Generation

    This can only be done with VBA. If that is acceptable I will move your thread to the VBA sub-forum.
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  3. #3
    Registered User
    Join Date
    12-06-2019
    Location
    Sri Lanka
    MS-Off Ver
    2016
    Posts
    7

    Re: Number Generation

    Hi Glenn,

    Im ok with it.

    Thank you

    Regards
    Dilan

  4. #4
    Forum Expert Roel Jongman's Avatar
    Join Date
    03-28-2015
    Location
    Netherlands
    MS-Off Ver
    Office 365
    Posts
    1,491

    Re: Number Generation

    Hi Dilanhj..

    try this code. I used 1 second for testing otherwise it takes you 5 minutes to know if it gets to 10 or not
    change 1 in the timeserial to 30 to wait 30 secs
    Please Login or Register  to view this content.
    Also in your own document
    - Change Activesheet to the sheetname f.e. worksheets("Sheet1") so the counter does not randomly popup on any sheet
    - Change Range("A1") to the actual cell where you want to show the counter

  5. #5
    Registered User
    Join Date
    12-06-2019
    Location
    Sri Lanka
    MS-Off Ver
    2016
    Posts
    7

    Re: Number Generation

    Hi Roel,

    It worked. Can you make the result at "A1" loop continuously once the count reaches 10 and start allover from number 1 again

    Regards
    Dilan

  6. #6
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,463

    Re: Number Generation

    Quote Originally Posted by DILANHJ View Post
    It worked. Can you make the result at "A1" loop continuously once the count reaches 10 and start allover from number 1 again
    If you do that, you will lock Excel up in an endless loop and you will not be able to use it until you have Windows Task Manager kill the process. There should be ways to get around this problem by adding some additional event procedures, but you still will not be able to use Excel while the count is going on. Is that what you really want?

  7. #7
    Registered User
    Join Date
    12-06-2019
    Location
    Sri Lanka
    MS-Off Ver
    2016
    Posts
    7

    Re: Number Generation

    Hi Rick,

    Yes, I need a endless loop. the sheet will be used as a dashboard.

    I did tried a formula with rand() function "=INT(RAND()*(10-1)+1)". The formula gets updates when the sheet is auto-updated or saved. The problem with the formula is, it returns a random number within the range given. my requirement is to return a incremental number from the range and loop.


    Regards
    Dilan

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

    Re: Number Generation

    You can use APPLICATION.ONTIME function instead of Application.Wait

    Please Login or Register  to view this content.

    You can call the STOPPROCESS procedure when the user closes the work book

    Please Login or Register  to view this content.
    Last edited by saravnepali; 12-09-2019 at 01:52 AM.
    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

  9. #9
    Registered User
    Join Date
    12-06-2019
    Location
    Sri Lanka
    MS-Off Ver
    2016
    Posts
    7

    Re: Number Generation

    Hi Saravnepali,

    As im new VBA, i did put the code on sheet and executed with "run Sub" command. I got an an error message "Cannot run the macro "***". The macros may not be available in this workbook or all macros may be disabled". However I see the cell contents at "A1" has increased.



    All trust settings are enabled

+ 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] ID number generation - with prefix
    By ania1224 in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 04-10-2018, 05:43 AM
  2. Number generation
    By AJHANSEN777 in forum Excel General
    Replies: 7
    Last Post: 10-07-2015, 02:38 AM
  3. Auto Number Generation
    By abdul43 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-10-2014, 02:21 PM
  4. automated ref number generation
    By Sal_m_78 in forum Excel General
    Replies: 16
    Last Post: 10-09-2009, 09:31 AM
  5. Automatic number generation.
    By BM in forum Excel General
    Replies: 1
    Last Post: 08-14-2006, 09:40 AM
  6. random number generation
    By scotjo in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-09-2006, 12:10 PM
  7. Random number generation
    By Stratuser in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-15-2005, 09:06 AM

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