title: VBA dice roll with addition
body: <p>VBA dice roll is very easy thing even for me, but I need specific type, when rolling 6 means you can roll again and add the two rolls together (plus when you roll 6 twice in a row, you get third roll and so on).</p>
  
  <p>I have tried two approaches, but both failed</p>
  
  <pre><code>Sub roll_dice_1()
  
  Dim result As Range
  
  Set result = Range("A1")
  
  result = Application.WorksheetFunction.RandBetween(1, 6)
  
  If result = 6 Then
    result = result + Application.WorksheetFunction.RandBetween(1, 6)
    Do Until Application.WorksheetFunction.RandBetween(1, 6) &lt;&gt; 6
    result = result + Application.WorksheetFunction.RandBetween(1, 6)
    Loop
     Else
  End If
  
  End Sub
  </code></pre>
  
  <p>This one however can produce result of 12, which is clearly impossible, because twice 6 should give third roll</p>
  
  <pre><code>Sub roll_dice_2()
  
  Dim result As Range
  
  Set result = Range("A1")
  
  result = Application.WorksheetFunction.RandBetween(1, 6)
  
  If result = 6 Then
    Do Until Application.WorksheetFunction.RandBetween(1, 6) &lt;&gt; 6
    result = result + Application.WorksheetFunction.RandBetween(1, 6)
    Loop
     Else
  End If
  
  End Sub
  </code></pre>
  
  <p>This one works even worse, because it can return 6.</p>
  
  <p>I tried search high and low, but all that I got were simple codes for simple throws, rolls with two dices and rolls when certain results can be rerolled. Again all options pretty easy, unlike this one</p>