function runs in VBE, but not from spreadsheet
Thanks.
JBeaucaire wrote:
Put this one extra line at the bottom just above the END FUNCTION:
ConvertTxtMo2NumMo = smonth
--
"Actually, I *am* a rocket scientist." -- JB
Your feedback is appreciated, click YES if this post helped you.
"Dave Peterson" wrote:
What happens when you use it in a formula like:
=ConvertTxtMo2NumMo(A1)
What did you put in A1?
And some other questions...
Where did you put this procedure? It belongs in a general module.
If it's in a different workbook's project, you'll need:
=book2.xls!ConvertTxtMo2NumMo(A1)
salgud wrote:
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?
--
Dave Peterson
--
Dave Peterson
|