Can you please provide a macro/VBA code to generate random numbers between 1 and 1.50 in col.M and 5 to 80 in multiple of 5 such as 5,15,50,65,25, etc in col.Q?
Nabam,
Assume the numbers start in row 2. Further assume I will use column A to determine the last cell to contain a number - the last cell in column A that is not empty will identify the last row to receive a number.
Sub GenerateRandom() Dim lastrow As Long, i As Long lastrow = Cells(Rows.Count, "A").End(xlUp).Row For i = 2 To lastrow
Cells(i, "M").Value = Rnd() * 0.05 + 1 Cells(i, "Q").Value = Int(Rnd() * 16 + 1) * 5
Next i End Sub
--
Tom Ogilvy
Advertisement