Random numbers without a macro?

cat3rn

New Member
Joined
Feb 3, 2014
Messages
33
I need to figure a way to make say cells A1 thru A10 produce random numbers from 0 to 9.

I would like to do it without a macro if possible. I also need a button to generate those random numbers. I know this button may make it impossible to not use a macro, but let's see if someone can. If it has to be done with a macro then so be it. I would appreciate it if someone could help me out.
 

Some videos you may like

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.

Harry Flashman

Active Member
Joined
May 1, 2011
Messages
354
I need to figure a way to make say cells A1 thru A10 produce random numbers from 0 to 9.

I would like to do it without a macro if possible. I also need a button to generate those random numbers. I know this button may make it impossible to not use a macro, but let's see if someone can. If it has to be done with a macro then so be it. I would appreciate it if someone could help me out.

Use can use a formula

=RANDBETWEEN(0,9)

You say you want a button? That would mean a macro. On the other hand if you just want to generate a new set of random numbers based on the formulas in existing cells simply press F9 (this will recalculate your formulas, thus generating new random numbers).
 

Harry Flashman

Active Member
Joined
May 1, 2011
Messages
354
I need to figure a way to make say cells A1 thru A10 produce random numbers from 0 to 9.

If it has to be done with a macro then so be it..

Here is a macro version. This will insert random numbers in A1:A10 of the active sheet.

Code:
Sub RandomZeroToNine()
Dim i As Long
For i = 1 To 10
    Cells(i, 1).Value = Int(Rnd(9) * 10)
Next i
End Sub

Insert a shape
Right-click and choose Assign a macro
Select the macro
 

cat3rn

New Member
Joined
Feb 3, 2014
Messages
33
I am so sorry maybe I should have been more clear.

I need to have cells A1 thru A 10 generate a random set of numbers each cell being a different number than any other in the range of cells.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,518
Messages
5,596,621
Members
414,082
Latest member
sasmita

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top