+ Reply to Thread
Results 1 to 13 of 13

Random numbers without a macro?

Hybrid View

  1. #1
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,156

    Re: Random numbers without a macro?

    hi cat3rn. you're right. it needs a macro if you want the button. Otherwise, you could give the user a simple instruction to generate them by pressing F9. F9 is to calculate. the numbers will change when done so. the formulas in A1 would be:
    =RANDBETWEEN(0,9)

    if you need the button,
    Sub test()
    
    Calculate
    
    End Sub
    How to install your new code
    1. Copy the Excel VBA code
    2. Select the workbook in which you want to store the Excel VBA code
    3. Press Alt+F11 to open the Visual Basic Editor
    4. Choose Insert > Module
    5. Edit > Paste the macro into the module that appeared
    6. Close the VBEditor
    7. Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)

    To run the Excel VBA code:
    1. Press Alt-F8 to open the macro list
    2. Select a macro in the list
    3. Click the Run button

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  2. #2
    Registered User
    Join Date
    08-23-2012
    Location
    89460
    MS-Off Ver
    Excel 2007
    Posts
    27

    Re: Random numbers without a macro?

    Quote Originally Posted by benishiryo View Post
    hi cat3rn. you're right. it needs a macro if you want the button. Otherwise, you could give the user a simple instruction to generate them by pressing F9. F9 is to calculate. the numbers will change when done so. the formulas in A1 would be:
    =RANDBETWEEN(0,9)

    if you need the button,
    Sub test()
    
    Calculate
    
    End Sub
    How to install your new code
    1. Copy the Excel VBA code
    2. Select the workbook in which you want to store the Excel VBA code
    3. Press Alt+F11 to open the Visual Basic Editor
    4. Choose Insert > Module
    5. Edit > Paste the macro into the module that appeared
    6. Close the VBEditor
    7. Save your workbook (Excel 2007+ select a macro-enabled file format, like *.xlsm)

    To run the Excel VBA code:
    1. Press Alt-F8 to open the macro list
    2. Select a macro in the list
    3. Click the Run button
    I like this Macro. How would I make it randomize the numbers in certain cells like E4 to N4 and D5 to D14 only.

+ 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] Macro to pick random unique numbers from lsit
    By dinesh_ltjd in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-16-2012, 02:11 PM
  2. Unique random numbers daily calculation macro
    By pco101 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 03-14-2011, 04:43 AM
  3. Can I use a macro to enter Poisson random numbers?
    By raphile in forum Excel Programming / VBA / Macros
    Replies: 15
    Last Post: 03-19-2009, 12:08 PM
  4. Non-random numbers generated by excel's data analysis random gener
    By Allie in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 09-17-2005, 02:05 AM
  5. [SOLVED] Re: Non-random numbers generated by excel's data analysis random gener
    By Harlan Grove in forum Excel General
    Replies: 2
    Last Post: 09-13-2005, 12:05 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