#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1
Default random number

Hi,

Can somebody tell me how to do this in Excel

I wish to create random number between 1 to 64 with reset value 0,
when a submit button is pressed a random single number is generated
between 1 to 64 and when reset button is pressed it goes back to 0 or
nil value.

Regards,
Mukhtar

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,886
Default random number

Hi

Add the following code to a standard module in your workbook
(instructions below if you don't know how)

Sub Generate1to64()
If Range("H1") 0 Then
Range("H1") = 0
Exit Sub
End If
Range("H1") = "=RANDBETWEEN(1,64)"
End Sub

This uses cell H1 on the sheet, change the location to suit.
It relies upon the Analysis Toolpak, so ensure ToolsAddinsanalysis
Toolpak is checked.

From the Forms toolbar, add a button to your sheet and assign the macro
above to it.

You can copy the code and paste it into your Visual Basic Editor
(VBE) in a Standard Module located in your file.
To do this,

Alt + F11 (open VBE)
Ctrl + R (open Project Explorer)
Select the file name on the left
Insert Module
Paste code in Module

David McRitchie has lots of useful help on his site at
http://www.mvps.org/dmcritchie/excel/install.htm
http://www.mvps.org/dmcritchie/excel/getstarted.htm


--
Regards

Roger Govier


wrote in message
ups.com...
Hi,

Can somebody tell me how to do this in Excel

I wish to create random number between 1 to 64 with reset value 0,
when a submit button is pressed a random single number is generated
between 1 to 64 and when reset button is pressed it goes back to 0 or
nil value.

Regards,
Mukhtar



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Random cell/number and dont repeat selected cell/number Hector PR Excel Discussion (Misc queries) 0 October 16th 06 05:02 PM
Pulling Data off Web - Need Function Help patfergie44 Excel Worksheet Functions 9 June 22nd 06 03:27 AM
same number appears in a random number generator Carmel Excel Worksheet Functions 4 May 28th 06 12:22 AM
random number generation scotjo Excel Worksheet Functions 4 January 9th 06 04:06 PM
Random Number Questions Greegan Excel Worksheet Functions 1 January 5th 05 02:00 AM


All times are GMT +1. The time now is 05:34 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"