samedi 6 novembre 2021

VBA- how can I automatically generate a random number after typing one to compare

For an VBA project I need to create a generator, that compares your "typed" number with a random one, generated by Excel. If you guessed correctly, you get a positive message, if not - a negative one. The problem is, that after guessing your number, the one displayed in the field for excel does not change.

I have the line

Range("G23").Value = "=RANDBETWEEN(1,36)"

but it does not change the cell value. Is there any way to connect the Cells G22 and G23, so that when I write a number between 1 and 36 in G22, and G23 generates a random number ?

Maybe something with If...Then?




Aucun commentaire:

Enregistrer un commentaire