title: Overflow error with Mod in VBA when value is in the billions or greater
body: <p>I am trying to find the largest prime divisor of a number x. When x is smaller than 1billion my code works but when it is greater than 1billion it gives an overflow error and debugging highlights the line with Mod in it.     </p>
  
  <pre><code> Sub Largest_Divisor()
      Dim x As Double
      Dim Q As Integer
      Q = 0
      Dim L() As Double
      x = 999999999#
      Dim i As Double
      For i = 775145 To 3 Step -2
          If x Mod i = 0 Then
              If IsPrime(i) Then
                  ReDim Preserve L(Q) As Double
                  L(Q) = i
                  Q = Q + 1
              End If
          End If
      Next i
      MsgBox (Application.Max(L))
   End Sub
  </code></pre>