I am trying to make a lottery generator of 5 box, idea is each box will have unique number every time I randomize it,
My code
If TextBox1.Value = TextBox2.Value Or TextBox1.Value = TextBox3.Value Or TextBox1.Value = TextBox4.Value Or TextBox1.Value = TextBox5.Value Then
TextBox1.Value = TextBox1.Value + 1
ElseIf TextBox2.Value = TextBox1.Value Or TextBox2.Value = TextBox3.Value Or TextBox2.Value = TextBox4.Value Or TextBox2.Value = TextBox5.Value Then
TextBox2.Value = TextBox2.Value + 1
ElseIf TextBox3.Value = TextBox1.Value Or TextBox3.Value = TextBox2.Value Or TextBox3.Value = TextBox4.Value Or TextBox3.Value = TextBox5.Value Then
TextBox3.Value = TextBox3.Value + 1
ElseIf TextBox4.Value = TextBox1.Value Or TextBox4.Value = TextBox2.Value Or TextBox4.Value = TextBox3.Value Or TextBox4.Value = TextBox5.Value Then
TextBox4.Value = TextBox4.Value + 1
ElseIf TextBox5.Value = TextBox1.Value Or TextBox5.Value = TextBox2.Value Or TextBox5.Value = TextBox3.Value Or TextBox5.Value = TextBox4.Value Then
TextBox5.Value = TextBox5.Value + 1
End If
Kindly focus on the highlighted code, this is my code to make unique random number in each 5 boxes, but, sometimes 1 in 100 it gives me the same number for any two box