How do I set up a "Random Number" button in Excel?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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?
 
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
__________________________
 

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

Back
Top