RANDOMIZE number max lenght 3
-
- PlatinumLounger
- Posts: 4355
- Joined: 26 Apr 2010, 17:36
RANDOMIZE number max lenght 3
How to randomize a number (max lenght 3) when i click on button and assign it to myvar1 (as string dimensioned)
-
- 2StarLounger
- Posts: 146
- Joined: 11 Jun 2012, 20:37
Re: RANDOMIZE number max lenght 3
Assign this sub to a button?
Code: Select all
Sub blah()
Randomize
myvar1 = CStr(Application.RandBetween(0, 999))
End Sub
-
- 4StarLounger
- Posts: 550
- Joined: 27 Jun 2021, 10:46
Re: RANDOMIZE number max lenght 3
If you want lowest number to be 1, then
randomize
myvar1 = Int(Rnd(1) * 999) + 1
else if you want 0 as trhe lowest number
randomize
myvar1 = Int(Rnd(1) * 1000)
randomize
myvar1 = Int(Rnd(1) * 999) + 1
else if you want 0 as trhe lowest number
randomize
myvar1 = Int(Rnd(1) * 1000)
-
- PlatinumLounger
- Posts: 4355
- Joined: 26 Apr 2010, 17:36
Re: RANDOMIZE number max lenght 3
TKS TO THE ALL!