Results 1 to 4 of 4

Thread: Why am I getting an overflow error on 365 * 100?

  1. #1

    Thread Starter
    Hyperactive Member Al Smith's Avatar
    Join Date
    May 1999
    Location
    Marcellus, MI. USA
    Posts
    330
    Hi,

    Why is the following code gives me an overflow error?

    Code:
    Dim XYZ As Double
    XYZ = 365 * 100
    Debug.Print XYZ
    I've also dimmed XYZ as Long, and Single and still get the error.

    Thanks,
    Al.



    A computer is a tool, not a toy.

  2. #2
    Hyperactive Member theman32x's Avatar
    Join Date
    May 2000
    Location
    New Jersey, USA
    Posts
    305

    that's weird

    i tried

    Code:
    Dim a As Long
    Dim b As Long
    Dim c As Long
    a = 100
    b = 365
    c = a * b
    Print c
    that works but don't know if that's what you wanted

    [Edited by theman32x on 08-26-2000 at 01:01 PM]

  3. #3
    Guest
    I am having a majorly hard time understanding this but MSDN recommends trying this:

    Code:
    Dim XYZ As Double
    XYZ = CDbl(365) * 100
    Debug.Print XYZ
    and it appears to work, just dont ask me why!


    [Edited by wossname on 08-26-2000 at 01:41 PM]

  4. #4
    Hyperactive Member theman32x's Avatar
    Join Date
    May 2000
    Location
    New Jersey, USA
    Posts
    305

    got it off a site

    you must use the CDbl function on it to explicitly make the parameter a Double

    ??????????????????????????????
    would your code be a parameter
    ??????????????????????????????

    [Edited by theman32x on 08-26-2000 at 04:11 PM]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width