I am trying to generate a random number between 2 and an integer inputed by the user through an InputBox which I call say 'k'. The code
ActiveCell.FormulaR1C1 = "=RANDBETWEEN(2, k)" does not work. It works only if I replace k by an integer greater than 2. I have checked that The variable k does equal the integer provided by the user. Thanks for the help
Welcome to the forum.
Post your code.
Microsoft MVP - Excel
Entia non sunt multiplicanda sine necessitate
Try it like this:
ActiveCell.FormulaR1C1 = "=RANDBETWEEN(2," & k & ")"
Hope this helps.
Pete
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks