Command button

G

Guest

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!!
 
S

Susan

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top