View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
johnsday johnsday is offline
external usenet poster
 
Posts: 6
Default Strange data type error

The following Function scans four tax tables (married, single etc) and
calculates the tax on the prize amount.
The functon works for all elements of the tax tables excpt one cell which
when read causes a data type error.
Placing the mousel pointer over each of the code piece for each cell shows a
number with an numeric data type, ie
Sheet2Cells(i,5)=665421. That is, all but Sheet2Cells(i,4)="1064.12" which
is a string data type. An indipendent check shows the 1064.12 to be numeric.
I can't figure this one out

Thanks for any help on this.


Function TaxIt(Prize As Currency, Status As Integer) As Currency
For i = Status To Status + 5
If i = (Status + 5) Or (Prize Sheet2.Cells(i, 2) And _
Prize < Sheet2.Cells(i, 3)) Then
TaxIt = Sheet2.Cells(i, 4) + Sheet2.Cells(i, 5) * (Prize -
Sheet2.Cells(i, 2))
Exit For
End If
Next
End Function