View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Dana DeLouis[_3_] Dana DeLouis[_3_] is offline
external usenet poster
 
Posts: 690
Default Negative numbers

Personal preference is to use the "Currency" data type to help avoid the
small rounding issues. Depending of course on what one is doing...
Dana DeLouis

"JE McGimpsey" wrote in message
...
Actually, for a completely different reason, Long might well be a good
way to go.

Longs will avoid many of the problems introduced by small rounding
errors in IEEE double precision floating point math. Values can be
internally multiplied and divided by 100 to match the currency
requirements.


So try() could be rewritten:

Public Sub try()
Dim MyValue As Long
With ActiveCell
MyValue = .Value * 100& - 2000&
.Value = MyValue \ 100&
End With
End Sub

However, I don't think that was the original responder's intention.


In article ,
"Norman Jones" wrote:

Since Jessie is clearly dealing with currency calculations, it would not
seem appropriate to dim your variable as either long or integer.

Further, why would you advocate using the Int function?