I have found code online to generate a random number using VBA (on click of button)
How do I get it to display a certain cell (H5) rather than in a msgbx?
How do I get it to display a certain cell (H5) rather than in a msgbx?
Code:
Sub random_num()
'Initialize the random number generator
'=> Randomize : add this before you call the Rnd function to obtain completely random values
Randomize
'Random whole number between 1 and 50 :
random_number = Int(50 * Rnd) + 1
MsgBox random_number
End Sub