A
Andrew Nelson
I have been trying to figure out for the last couple of hours what code is
used to clear a listbox in VBA and also how to sort the results at the end.
Attached is a copy of the code that I have written so far. Any assistance
would be greatly appreciated. Thanks!
'generate the number of random numbers needed
iRandomNumberCount = Round((stNumberofDiscrepancies * 0.1), 0)
If Val(iRandomNumberCount) >= 10 And Val(iRandomNumberCount) <= 50
Then
iTotalCount = iRandomNumberCount
ElseIf Val(iRandomNumberCount) < 10 Then
iTotalCount = 10
ElseIf Val(iRandomNumberCount) > 50 Then
iTotalCount = 50
End If
'create the header
If lstRandomNumbers.ListCount = 0 Then
lstRandomNumbers.AddItem "ID Number"
End If
'generate the numbers needed to populate in table
For iCounter = 1 To Val(iTotalCount)
'Generate random number
iRandomNumber = Int(stNumberofDiscrepancies * Rnd)
lstRandomNumbers.AddItem iRandomNumber
Next iCounter
used to clear a listbox in VBA and also how to sort the results at the end.
Attached is a copy of the code that I have written so far. Any assistance
would be greatly appreciated. Thanks!
'generate the number of random numbers needed
iRandomNumberCount = Round((stNumberofDiscrepancies * 0.1), 0)
If Val(iRandomNumberCount) >= 10 And Val(iRandomNumberCount) <= 50
Then
iTotalCount = iRandomNumberCount
ElseIf Val(iRandomNumberCount) < 10 Then
iTotalCount = 10
ElseIf Val(iRandomNumberCount) > 50 Then
iTotalCount = 50
End If
'create the header
If lstRandomNumbers.ListCount = 0 Then
lstRandomNumbers.AddItem "ID Number"
End If
'generate the numbers needed to populate in table
For iCounter = 1 To Val(iTotalCount)
'Generate random number
iRandomNumber = Int(stNumberofDiscrepancies * Rnd)
lstRandomNumbers.AddItem iRandomNumber
Next iCounter