function runs in VBE, but not from spreadsheet
Close, but no cigar:
Public Function ConvertTxtMo2NumMo(iMonth)
Select Case iMonth
Case Is = 1
ConvertTxtMo2NumMo = "Jan"
Case Is = 2
ConvertTxtMo2NumMo = "Feb"
Case Is = 3
ConvertTxtMo2NumMo = "Mar"
Case Is = 4
ConvertTxtMo2NumMo = "Apr"
Case Is = 5
ConvertTxtMo2NumMo = "May"
Case Is = 6
ConvertTxtMo2NumMo = "Jun"
Case Is = 7
ConvertTxtMo2NumMo = "Jul"
Case Is = 8
ConvertTxtMo2NumMo = "Aug"
Case Is = 9
ConvertTxtMo2NumMo = "Sep"
Case Is = 10
ConvertTxtMo2NumMo = "Oct"
Case Is = 11
ConvertTxtMo2NumMo = "Nov"
Case Is = 12
ConvertTxtMo2NumMo = "Dec"
End Select
End Function
"salgud" wrote in message
.. .
Been fooling with this for a while, trying to figure out why this function
works fine when called or when I insert a debug.print or a message box,
but
it won't run from a formula in the spreadsheet.
Public Function ConvertTxtMo2NumMo(iMonth)
Select Case iMonth
Case Is = 1
sMonth = "Jan"
Case Is = 2
sMonth = "Feb"
Case Is = 3
sMonth = "Mar"
Case Is = 4
sMonth = "Apr"
Case Is = 5
sMonth = "May"
Case Is = 6
sMonth = "Jun"
Case Is = 7
sMonth = "Jul"
Case Is = 8
sMonth = "Aug"
Case Is = 9
sMonth = "Sep"
Case Is = 10
sMonth = "Oct"
Case Is = 11
sMonth = "Nov"
Case Is = 12
sMonth = "Dec"
End Select
End Function
Any suggestions?
|