-
VBA run time error 6 'overflow'
Hi Guys
New to this board and hope you can help.
I have an array which is declared as type long but when presented with variables a = 555 and b = 555555 the following multiplication cannot be performed.
Dim Var as long
Var = a * b
I get a runtime error 6 'overflow' message.
This is a simple example which I tried when my actual code did not work.
Any help appreciated.
Thanks
-
I have no problem with this code
[VBA]
Sub test()
Dim a, b
Dim var As Long
a = 555
b = 555555
var = a * b
MsgBox var
End Sub
[/VBA]
-
Likewise. Can you post your sampe that fails?
[VBA]
Option Explicit
Sub test()
Dim ary(0 To 2) As Long
ary(0) = 555
ary(1) = 555555
ary(2) = ary(0) * ary(1)
MsgBox ary(2)
End Sub
[/VBA]
Paul
-
Dear no problem with this code Sub test()
Dim a, b
Dim var As Long
a = 555
b = 555555
var = a * b
MsgBox var
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules