What is wrong with my Select Case?

A

Al

The following code does not work I do not know why. the number that I am
checking is "0.00338076308652524" which is < 1 but I am not getting the
result which is " less than" in the text box "RF34d" (RF34d =
NumbertoLetters(RF34c))
any idea?
thanks




***********************************************
Private Function NumbertoLetters(numTolet As Integer) As String

Select Case Format(numTolet, "##")
Case Is < 1
NumbertoLetters = " less than"
end select
end function
**********************************************
 
D

Dale Fye

Al,

The format function converts your number to a string, so your comparison
compares the text string to a number. Also, in your format declaration
statement, you have defined numTolet as an integer, but are passing a single
or double. This should not be the problem, but I would change it anyway.
***********************************************
Private Function NumbertoLetters(numTolet As Integer) As String

Select Case numTolet
Case Is < 1
NumbertoLetters = " less than"
end select
end function
**********************************************

HTH
Dale
 
A

Al

Yes, you are right. It worked, thanks
Al

Dale Fye said:
Al,

The format function converts your number to a string, so your comparison
compares the text string to a number. Also, in your format declaration
statement, you have defined numTolet as an integer, but are passing a single
or double. This should not be the problem, but I would change it anyway.


HTH
Dale
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top