title: Why does "Run-time error '6': Overflow" pop up when the long variable is within allowed range?
body: <p>When I run the following code it gives me "Run-time error '6': Overflow" even if the variable is within allowed range according to <a href="https://docs.microsoft.com/en-us/dotnet/visual-basic/language-reference/data-types/long-data-type" rel="nofollow noreferrer">this</a>:</p>
  
  <pre><code>Sub Test()
  Dim a As Long
  a = 4 * 10000
  Debug.Print a
  End Sub
  </code></pre>
  
  <p>If I replace 4 with long variable, it works fine:</p>
  
  <pre><code>Sub Test()
  Dim a As Long
  Dim b As Long
  b = 4
  a = b * 10000
  Debug.Print a
  End Sub
  </code></pre>
  
  <p>Or If I replace 4 with 3, it works fine again:</p>
  
  <pre><code>Sub Test()
  Dim a As Long
  a = 3 * 10000
  Debug.Print a
  End Sub
  </code></pre>
  
  <p>What is the reason of this?</p>