![]() |
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 |
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 |
All times are GMT +1. The time now is 01:31 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com