I have this program written in VBA:
Function GetFive()
Dim iNum As String
Dim iNum2 As String
Dim strNum As String
Dim i As Integer
Dim j As Integer
Dim Counterko As Integer
Dim checker(1 To 5) As String
Counterko = Int((22 * Rnd) + 1)
iNum = "A" & Counterko
strNum = Worksheets("Sheet1").Range(iNum).Value
iNum2 = iNum
For i = 1 To 5
strNum = Trim(strNum & " " & strNum2)
'MsgBox (strNum)
checker(i) = iNum2
' MsgBox ("i=" & i & "iNum2=" & iNum2)
Counterko = Int((22 * Rnd) + 1)
iNum2 = "A" & Counterko
For j = 1 To i
If iNum2 = checker(j) Then
i = i - 1
strNum2 = ""
Exit For
Else
iNum = iNum2
strNum2 = Worksheets("Sheet1").Range(iNum2).Value
End If
Next j
Next i
Now I need to add that will choose a number between for the first number 1-17, second number 4-30, third number 12-42, fourth number 28-52 and fifth number 38-56 and it would give me a 15 group of numbers. I am also would like to add the "click" button. I not realy good in doing this kindna I just combined what i found in the internet but I can't seem to find this one. Thanks in advance.
Function GetFive()
Dim iNum As String
Dim iNum2 As String
Dim strNum As String
Dim i As Integer
Dim j As Integer
Dim Counterko As Integer
Dim checker(1 To 5) As String
Counterko = Int((22 * Rnd) + 1)
iNum = "A" & Counterko
strNum = Worksheets("Sheet1").Range(iNum).Value
iNum2 = iNum
For i = 1 To 5
strNum = Trim(strNum & " " & strNum2)
'MsgBox (strNum)
checker(i) = iNum2
' MsgBox ("i=" & i & "iNum2=" & iNum2)
Counterko = Int((22 * Rnd) + 1)
iNum2 = "A" & Counterko
For j = 1 To i
If iNum2 = checker(j) Then
i = i - 1
strNum2 = ""
Exit For
Else
iNum = iNum2
strNum2 = Worksheets("Sheet1").Range(iNum2).Value
End If
Next j
Next i
Now I need to add that will choose a number between for the first number 1-17, second number 4-30, third number 12-42, fourth number 28-52 and fifth number 38-56 and it would give me a 15 group of numbers. I am also would like to add the "click" button. I not realy good in doing this kindna I just combined what i found in the internet but I can't seem to find this one. Thanks in advance.