I have a macro that creates in two files with names that complies with a convention. The convention includes also a random number of 4 digits. To create this code I am using the following function to create a number in the range [1111..9999] :
>>> use code - tags <<<
In all the tests that I ran the number for each of the two files was different but in each run each file got always the same number.
When I ran a test with only this function and no other code I got each time a different number.
Any idea how this happens?
>>> use code - tags <<<
Code:
Function random_number() As String
Dim myRnd As Integer
myRnd = Int(1000 + Rnd * (9999 - 1111 + 1))
random_number = Trim(Str(myRnd))
End Function
When I ran a test with only this function and no other code I got each time a different number.
Any idea how this happens?
Last edited by a moderator: