I'm trying to create in sub 1 a variable called Final which is 4 Random numbers (1-6) Minus the smallest of the 4 Random Numbers in the calculation.
Then I want to use that number (Final) in another sub. And I want the number generated in the second sub to be a different random number each time and put those numbers in 6 listboxes.
Sub StatRoll()
Dim Stat1 As Integer
Stat1 = Int(6 * Rnd + 1)
Dim Stat2 As Integer
Stat2 = Int(6 * Rnd + 1)
Dim Stat3 As Integer
Stat3 = Int(6 * Rnd + 1)
Dim Stat4 As Integer
Stat4 = Int(6 * Rnd + 1)
Dim Total As Integer
Total = Stat1 + Stat2 + Stat3 + Stat4
Dim Min As Integer
Min = WorksheetFunction.Min(Stat1, Stat2, Stat3, Stat4)
Dim Final As Integer
Final = Total - Min
End Sub
Private Sub Level1UserformRollStatsButton_Click()
'empty Level1UserformStat1List
Level1UserformStat1List.Clear
'fill Level1UserformStat1List
With Level1UserformStat1List
.AddItem Final
End With
End Sub
Again, I want to fill 6 List Boxes with One number each. The number being a Random number each time consisting of 4 Random numbers minus (1-6) the smallest of the 4.
Thanks in Advance
Bookmarks