+ Reply to Thread
Results 1 to 5 of 5

Variable overflow

  1. #1
    Derick Hughes
    Guest

    Variable overflow


    Is there a way for a large number to be assigned to a variable? For
    example:

    Dim maxlen as Currency

    Sub
    maxlen = application.worksheetfunction.combin(60,20)
    End sub

    maxlen produces an overflow error. Is there a way around this?


    Regards
    Dk

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

  2. #2
    Nigel
    Guest

    Re: Variable overflow

    Dim maxlen as Double

    --
    Cheers
    Nigel



    "Derick Hughes" <hughedn@hotmail.com> wrote in message
    news:e89FfWSSGHA.4952@TK2MSFTNGP09.phx.gbl...
    >
    > Is there a way for a large number to be assigned to a variable? For
    > example:
    >
    > Dim maxlen as Currency
    >
    > Sub
    > maxlen = application.worksheetfunction.combin(60,20)
    > End sub
    >
    > maxlen produces an overflow error. Is there a way around this?
    >
    >
    > Regards
    > Dk
    >
    > *** Sent via Developersdex http://www.developersdex.com ***




  3. #3
    Tom Ogilvy
    Guest

    RE: Variable overflow

    use a double. Numbers in the Excel sheet are doubles

    from the immediate window:
    a = application.combin(60,20)
    ? a
    4.1918445058055E+15

    --
    Regards,
    Tom Ogilvy


    "Derick Hughes" wrote:

    >
    > Is there a way for a large number to be assigned to a variable? For
    > example:
    >
    > Dim maxlen as Currency
    >
    > Sub
    > maxlen = application.worksheetfunction.combin(60,20)
    > End sub
    >
    > maxlen produces an overflow error. Is there a way around this?
    >
    >
    > Regards
    > Dk
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    >


  4. #4
    Daniel
    Guest

    RE: Variable overflow

    Thanks, Using double still poses a problem. I would using maxlen in a
    loop and reducing it by 1 after each iteration.


    Regards
    Dk

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

  5. #5
    Tom Ogilvy
    Guest

    RE: Variable overflow

    why would you even think about looping over a number like that. The value
    returned by combin only has 15 significant digits, so you are not getting the
    exact number any how

    Anyway, even if it took 1 millionth of a second to do each loop, it would
    take around 132 years to complete the loop. I could be off by a couple of
    years.

    --
    Regards,
    Tom Ogilvy


    "Daniel" wrote:

    > Thanks, Using double still poses a problem. I would using maxlen in a
    > loop and reducing it by 1 after each iteration.
    >
    >
    > Regards
    > Dk
    >
    > *** Sent via Developersdex http://www.developersdex.com ***
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1