I did not really follow this thread, but I see that David put you in the right
direction regarding the differences between string and integer data types.
It is not enough for you to declare the variable as integer or single.
In your code I read that you wrote twice
Val <> "" or val = "".
To the best of my knowledge "" is used only for string.
(I checked and I see that when you use "" with integer data types you get a
"type mismatch" error).
If you want to check for an empty variable use the
val = empty (this is good for integer as well as string types I believe).
Where is the PrevLowVal variable initialized???