I have added the function below to the workbook level of my VBA
Function Mileage(CostCentre)
' Checks for employees cost centre and subs correct one
Select Case CostCentre
Case "120.": Mileage = "130."
Case "220.": Mileage = "230."
Case "125.": Mileage = "130."
Case "225.": Mileage = "230."
Case "150.": Mileage = "140."
Case "250.": Mileage = "240."
End Select
End Function
The problem is that when I enter =Mileage(B4) in a cell, where B4 is the test valve, it returns #name? I have entered a simple function like:
Function user(user As String)
user = Application.UserName
End Function
And when I enter =User() in the cell I get #name? instead of my own name.
Any one know what I am doing wrong?
Thanks for any help.
Function Mileage(CostCentre)
' Checks for employees cost centre and subs correct one
Select Case CostCentre
Case "120.": Mileage = "130."
Case "220.": Mileage = "230."
Case "125.": Mileage = "130."
Case "225.": Mileage = "230."
Case "150.": Mileage = "140."
Case "250.": Mileage = "240."
End Select
End Function
The problem is that when I enter =Mileage(B4) in a cell, where B4 is the test valve, it returns #name? I have entered a simple function like:
Function user(user As String)
user = Application.UserName
End Function
And when I enter =User() in the cell I get #name? instead of my own name.
Any one know what I am doing wrong?
Thanks for any help.