View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
JE McGimpsey JE McGimpsey is offline
external usenet poster
 
Posts: 4,624
Default Negative numbers

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?