How do I set up a "Random Number" button in Excel?
On Tue, 24 Oct 2006 14:25:02 -0700, jnoriega
wrote:
I’m creating a quote price spreadsheet to keep track of what we quote our
customers and in one of the rows I would like to add a button that generates
a random number. This random number becomes the ID number so we can give to
our customer in case that they reach another representative. Is this
possible?
Just add a button from the toolbox, right click and put something like
the following code in the button's click event.
Private Sub CommandButton1_Click()
Randomize
ActiveCell = Round(Rnd * 1000, 0)
End Sub
But are you sure you want a random number? It's possible that you
might still duplicate a number. Why not control a normal variable
number by incrementing it by say 1, each time the button is pressed?
Rgds
__
Richard Buttrey
Grappenhall, Cheshire, UK
__________________________
|