I am trying to get VBA to pick a random value from a range of values and output this value in Cell E6. Some of the cells within this input range of values are blank so I need to tell VBA to pick it from a cell that contains a value. I really am unsure how to do this. I will copy what I have below. The range of which the values to choose from is H127:1127 (a lot of which are empty)
Sub Generate()
Dim i As Double
Dim ws As Worksheet
Set ws = Sheets("Upstream-Overall")
For Each Cell In ws.Range("H127:H1127")
If ActiveCell.Value <> "" Then
Range("E6") = Random_Number = Application.WorksheetFunction.RandBetween(0.1, 5)
End If
Next Cell
End Sub