I've looked online and found a way to create random numbers with decimals. However, the formula I found online isn't working exactly how I thought it would. I want random numbers to generate between the numbers 20-22 with only one decimal place. I get some numbers that are rounded, some that are not, along with values that are not between 20-22. I've also used single parenthesis with Round and it seems to do the exact same. How can I fix this problem? Below is my code you can use to see what's happening.
Dim rng As Range, num As Byte, x, i As Double, j num = InputBox("Enter number here", "Input", 5) Set rng = Range("A3") rng.Resize(, 5) = Array("Treatment", "Mean", "Std Dev", "Min", "Max") rng.Resize(, 5).Borders(4).Weight = xlThin rng.Offset(1).Resize(num) = Evaluate("row(" & Cells(1).Resize(num).Address & ")") For j = 1 To 4 For x = 1 To num i = Round((20 + Rnd * 22), 1) rng.Offset(x, j) = i Next Next