View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Sharad Sharad is offline
external usenet poster
 
Posts: 123
Default Data Types help ... Overflow errors


Does used or guests exceed figure 2,147,483,647
(i.e. two billions and something)?
If not then
can result exceed E+38 or can be less than E-45?

If not then can guests be zero (0)?

Change the code as under and try:-

Dim used, guests As Long, result As Single
If geusts = 0 Then
MsgBox "Zero guests will make it divide by zero _
and cause overflow!"
Exit Sub
End If
result = (used / guests) * 100


Sharad

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!