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
--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 97/00/02/03
----------------------------------------------------------------------------
It's easier to beg forgiveness than ask permission

----------------------------------------------------------------------------