ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Command button (https://www.excelbanter.com/excel-programming/387807-command-button.html)

Khanjohn

Command button
 
Here is what I wnt to do. I will use +INT(RAND()*(100-1)+1) to generate a
number but i do not wnat to use the function key F9 to do this. Would liek a
command button to push and have ti generate the number in cell below. I do
not under stand the command buton but knwo how to get on up but that is it.
Please help!!

Susan

Command button
 
you can use the control toolbox to place a command button on the
worksheet. right click the button & choose properties to edit text on
button, etc.
double-click on button to automatically open code editor to correct
location.
code would be something like:

dim rRange as range
dim sFormula as string

set rRange = activecell
sFormula = "=+INT(RAND()*(100-1)+1)"

worksheet.range(rRange).offset(1,0) = sFormula


so every time you click the worksheet button, the cell you are on when
you click it will have the formula entered in the cell below.
modify formula as necessary.
hope this helps!
susan


On Apr 20, 7:40 am, Khanjohn
wrote:
Here is what I wnt to do. I will use +INT(RAND()*(100-1)+1) to generate a
number but i do not wnat to use the function key F9 to do this. Would liek a
command button to push and have ti generate the number in cell below. I do
not under stand the command buton but knwo how to get on up but that is it.
Please help!!





All times are GMT +1. The time now is 03:17 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com