Excel 2002 and VB declaring number as double

G

Gary

I have a program in VB in excel that parses a text file and loads the numbers
into the spread sheet. The problems is the numbers have gotten bigger, and
are now over 2.2 billion.
Dim Qty as long
I had the declaration above and then changed it to
Dim Qty as double
but it did not change the dim it still crashes if number is 2.17 billion or
higher

gary
 
S

Shane Devenshire

Hi,

Double will handle number far larger than 2.17 billion. When is excel
crashing (what are the steps and which one brings Excel down?). Is this an
Excel VBA program or are you doing this externally. If in Excel, what is
your code? Are the numbers over 2.17 billion stored in the other program as
number, text or what?

floating-point numbers ranging in value from -1.79769313486231E308 to
-4.94065645841247E-324 for negative values and from 4.94065645841247E-324 to
1.79769313486232E308 for positive values
 
G

Gary

RdStr = Trim(Left(RdStr, X))
X = InStr(1, RdStr, " ")
Worksheets("Production").Cells(33, 5) = RdStr "used
to see where crashes
Qty = CLng(Left(RdStr, X - 1)) 'Crashes here
TechName = Right(RdStr, (Len(RdStr) - X))

Worksheets("Data").Cells(ct2, DataC) = TechName
Worksheets("Data").Cells(ct2, DataC + 1) = Qty

It crashes with error code 6 overload
this is what is in the string

2,780,257,000 Raw Resources
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top