Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SELECT CASE..... 2

Status
Not open for further replies.

KUZZ

Technical User
Aug 13, 2002
254
GB
I have the following:

Function UCA()
Dim UCAN As String
UCAN = UASS
Select Case UCAN
Case Is > 15
UCA = 0
Case 14 To 15
UCA = 1
Case 13 To 14
UCA = 2
Case 12 To 13
UCA = 3
Case 11 To 12
UCA = 4
Case 10 To 11
UCA = 5
Case 9 To 10
UCA = 6
Case 8 To 9
UCA = 7
Case 7 To 8
UCA = 8
Case 6 To 7
UCA = 9
Case 5 To 6
UCA = 10
Case 4 To 5
UCA = 11
Case 3 To 4
UCA = 12
Case 2 To 3
UCA = 13
Case 1 To 2
UCA = 14
Case Is < 1
UCA = 15
End Select
End Function

what do I have to do to make the funcion UCA() equal to say 1 for every value (even decimal) within 14 and 15, e.g. 14.38 Good luck,
Kuzz

&quot;Time spent debating the impossible subtracts from the time during which you
can try to accomplish it.&quot;
 
Change

Function UCA()

TO

Function UCA() as Long

;-)
 
i think I ended up calling it

FUNCTION UCA() as sigle and it fixed the whole situation...but yeah...as long would have probabli, as well solved the problem Good luck,
Kuzz

&quot;Time spent debating the impossible subtracts from the time during which you
can try to accomplish it.&quot;
 
i think this is a bit shorter
alltough im not sure what for example 14 should its not between 13 and 14 (2) and not between 14 and 15 (1) so is it 14 1 or 2

Private Function Function_Uca(Local_Ucan As Double) As Long
Select Case Local_Ucan
Case Is > 15
Function_Uca = 0
Case Is < 1
Function_Uca = 15
Case Else
Function_Uca = Int((Local_Ucan * -1) + 15) + 1
End Select
End Function &quot;What a wonderfull world&quot; - Louis armstrong
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top