Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 923
Default Variable overflow

Dim maxlen as Double

--
Cheers
Nigel



"Derick Hughes" wrote in message
...

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default 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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Overflow Erik Beck Jensen Excel Programming 2 December 13th 05 10:11 AM
Overflow Error DG Excel Programming 3 April 15th 05 05:45 PM
buffer overflow Jeff Sward Excel Programming 0 January 7th 04 07:46 PM
VBA overflow Tom Ogilvy Excel Programming 3 September 2nd 03 09:04 PM
VBA overflow Don Guillett[_4_] Excel Programming 2 September 2nd 03 04:19 PM


All times are GMT +1. The time now is 09:14 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"