Home All Groups Group Topic Archive Search About

Error 6 Overflow when multiply

Author
8 Mar 2009 7:39 AM
Goerge Tikakis
When i'm multiply the values 1024 * 12000 i get the error Overflow
I take the same error even in Immediate window
Any ideas?

*** Sent via Developersdex http://www.developersdex.com ***

Author
8 Mar 2009 7:46 AM
Goerge Tikakis
Try 1024& * 12000&

*** Sent via Developersdex http://www.developersdex.com ***
Author
8 Mar 2009 12:44 PM
christery
On 8 Mar, 08:46, Goerge Tikakis <nos***@devdex.com> wrote:
> Try 1024& * 12000&
>
> *** Sent via Developersdexhttp://www.developersdex.com***

or 1024& * 12000

Save one char, they will be a shortage... eventually, nah, just joking
- its like oil: there is enough to go around as long as we dont use
it.

Why dont dim the variable to a single or double or if only integer, a
long...

ehh like

Sub x()
' Wont work : Dim x_ As Integer
Dim x_ As Long
' Dim x_ As Single ' gets 1,2288E+07
' Works : Dim x_ As Double ' got 12288000

x_ = 1024 * clng(12000)
Debug.Print x_

End Sub

or something...

//CY
Author
8 Mar 2009 5:07 PM
Randy Birch
http://vbnet.mvps.org/code/faq/faqqa.htm

look near the bottom for 'Why do I get an Overflow Error when multiplying?'


--

Randy
ms mvp, visual basic
http://vbnet.mvps.org/


Show quoteHide quote
"Goerge Tikakis" <nospam@devdex.com> wrote in message
news:er%23FQE8nJHA.5468@TK2MSFTNGP04.phx.gbl...
>
>
> When i'm multiply the values 1024 * 12000 i get the error Overflow
> I take the same error even in Immediate window
> Any ideas?
>
> *** Sent via Developersdex http://www.developersdex.com ***