=rand() command

  • Thread starter Thread starter Andrea
  • Start date Start date
A

Andrea

I have many columns of data for which I need to get random numbers, then
lock them in with the edit, paste special/value commands before sorting. Is
there any way to do this except column by column? It gets the job done, but
it's very tedious and time-consuming? Thanks.
 
You could use a macro such as:

This fills in decimals
Sub FillRndNos()
Dim c
For Each c In Selection
c.Value = Rnd()
Next
End Sub

This fills in Integers between 1 & 24

Sub Fill2()
For Each c In Selection
c.Value = CInt(Rnd() * 24 + 1)
Next
End Sub

Regards
Peter
 

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