hi there i don't know if this is the right section, however I was
wondering is there some vba or formulae to generate random numbers in a
certain range
I would be very greatful if you can help me
Thanks
Owen

Signature
manclad
Dave Peterson - 30 Dec 2005 23:30 GMT
I like J.E. McGimpsey's =RandInt().
http://www.mcgimpsey.com/excel/udfs/randint.html
> hi there i don't know if this is the right section, however I was
> wondering is there some vba or formulae to generate random numbers in a
[quoted text clipped - 11 lines]
> manclad's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=30016
> View this thread: http://www.excelforum.com/showthread.php?threadid=497074

Signature
Dave Peterson
L. Howard Kittle - 30 Dec 2005 23:30 GMT
=rand() and pull down is the plain answer. May not meet your need's.
More info, perhaps?
HTH
Regards,
Howard
> hi there i don't know if this is the right section, however I was
> wondering is there some vba or formulae to generate random numbers in a
[quoted text clipped - 5 lines]
>
> Owen
Ken Wright - 31 Dec 2005 00:25 GMT
Try this. Assign a keyboard combo to it, hit the combo and you will be
prompted for an upper bound, a lower bound and then as to whether you want
decimals or integers.
Sub RandomNumber()
ubnd = InputBox("Enter Upper Bound")
lbnd = InputBox("Enter Lower Bound")
nudp = InputBox("Just hit OK for Integers or type D for decimals")
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
On Error GoTo Oops:
c = Selection.Cells.Count
x = 1
If UCase(nudp) = "D" Then
With Selection
.ClearContents
.NumberFormat = "#,##0.00"
End With
For Each cell In Selection
cell.Value = Rnd() * (ubnd - lbnd) + lbnd
Application.StatusBar = Round(x / c, 2) * 100 & "% Done"
x = x + 1
Next cell
Else
With Selection
.ClearContents
.NumberFormat = "#,##0"
End With
For Each cell In Selection
cell.Value = Int(Rnd() * (ubnd - lbnd + 1) + lbnd)
Application.StatusBar = Round(x / c, 2) * 100 & "% Done"
x = x + 1
Next cell
End If
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
Application.StatusBar = False
Oops: Exit Sub
End Sub

Signature
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 97/00/02/03
----------------------------------------------------------------------------
It's easier to beg forgiveness than ask permission :-)
----------------------------------------------------------------------------
> hi there i don't know if this is the right section, however I was
> wondering is there some vba or formulae to generate random numbers in a
[quoted text clipped - 5 lines]
>
> Owen
tkt_tang@hotmail.com - 31 Dec 2005 03:07 GMT
Say, RandBetween(1, 100) ; more details from the Help File. Regards.
joeu2004@hotmail.com - 31 Dec 2005 11:00 GMT
> I was wondering is there some vba or formulae
> to generate random numbers in a certain range
.... With what distribution? So far, every respondent has
ass-u-me-d you want a uniform distribution. I wonder if
you might be interested in another distribution, e.g. a
normal distribution.