View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default Random number macro

Hi,

Try this

Sub standard()
Top = Range("P2").Value
For x = 1 To Range("P1").Value
ActiveCell.Offset(x - 1) = Int((Top - 1 + 1) * Rnd + 1)
Next
End Sub

Mike

"Victor Delta" wrote:

I would like to create an Excel macro which will put a series of random
integers (leaving values not the formulas) in cells in a column. It should
start in the currently selected cell and fill downwards until it has covered
the number of cells given by the number in, say, cell P1. The random
integers should be between 1 and the number in cell P2 (inclusive).

Can anyone help please?

Many thanks,

V