Question : Excel 2007 VBA Function returns as 'empty'

I have a function set up to return a 0, 1 or 2 based on certain conditions. I have tested the conditions and they work properly, but the function returns an empty value. The code is below - Can anyone tell me what I am missing?
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
Public Function WO_Logged_In(ByVal terminal As Long, ByVal data As String)
'check internal table to see if the Workorder is logged in 

Dim X As String, Y As String

Call Sorter("Internal", "E2", "E:E")

X = Do_Lookup("Internal", TerminalDataRecord(terminal).TermDataSet(60), "E:F", 2)
Select Case X

    Case X = ""
       WO_Logged_In = 0 'available for log in to a station
    
    Case X = TerminalDataRecord(terminal).TermDataSet(60)
        WO_Logged_In = 1 'logged into scanned station
        
    Case X <> TerminalDataRecord(terminal).TermDataSet(60)
        WO_Logged_In = 2 'logged into a different station then scanned
        
End Select

End Function

Answer : Excel 2007 VBA Function returns as 'empty'

You have forgot to type the return of the function. Change its declaration like below:

Public Function WO_Logged_In(ByVal terminal As Long, ByVal data As String) as Integer
Random Solutions  
 
programming4us programming4us