View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
NickHK NickHK is offline
external usenet poster
 
Posts: 4,391
Default overflow problem and variable declaration

Valeria,
I cannot reproduce your error, with XL2002.
In the watch window, I see a value of -9E+15, with a Type of Variant/Double.

NickHK

"Valeria" wrote in message
...
Hi,
one of the cells that is being counted has a value of -9*10^15, which is
what is giving me the overflow.
I can see it by using the "watch" window:
ActiveWorkbook.Worksheets("Complete_PM_List").Cell s(i, 9).Value
<Overflow Variant/Integer

Could you please help me with this?
Thanks,
Best regards
--
Valeria


"NickHK" wrote:

Valeria,
What makes you think it is an Integer ? Using the immediate window, I

get:

range("a6").Value=cint(100)
?typename(range("a6").Value)
Double

I suspect your error is elsewhere.
What is the value of LastRow ?

Also, maybe this is easier to read:

With ActiveWorkbook.Worksheets("Complete_PM_List")
.Cells(i, 15).Value =.Cells(i, 6).Value *.Cells(i, 9).Value
End With

NickHK

"Valeria" wrote in message
...
Dear experts,
I am getting an overflow error type because I am not able to declare

my
variables the way they should be (ex long).
I have a code like:
For i=2 to LastRow
ActiveWorkbook.Worksheets("Complete_PM_List").Cell s(i, 15) =
ActiveWorkbook.Worksheets("Complete_PM_List").Cell s(i, 6) *
ActiveWorkbook.Worksheets("Complete_PM_List").Cell s(i, 9)
Next i

How do I declare

ActiveWorkbook.Worksheets("Complete_PM_List").Cell s(i, 9)
to be long and not taken as Variant.Integer which is the way Excel

handles
it
today?

Many thanks in advance for your help.
Best regards,
--
Valeria