Can someone help me with this:
I have an excel spreadsheet that I am trying to write some code for:
In my spreadsheet I have reference the formula by using: =mySuffix(m2) where m2 is the cell I want to run the formula on.
What I get is: #NAME? and I cant figure it out. I tried replacing all code to just return "a" or anything to make sure it wasnt my code and I get the same thing. It is like Excel doesnt see my function. I right-clicked the worksheet and put the above in the view code section.
Thanks.
I have an excel spreadsheet that I am trying to write some code for:
Code:
Public Function mySuffix(suffix As String) As String
If CInt(suffix) < 100 Then
mySuffix = suffix
Else
myChr = CInt(suffix) - 100
If myChr <= 26 Then
mySuffix = Chr(96 + myChr)
Else
leadChr = CInt(myChr / 26)
farChr = myChr - (leadChr * 26)
mySuffix = leadChr & farChr
End If
End If
End Function
In my spreadsheet I have reference the formula by using: =mySuffix(m2) where m2 is the cell I want to run the formula on.
What I get is: #NAME? and I cant figure it out. I tried replacing all code to just return "a" or anything to make sure it wasnt my code and I get the same thing. It is like Excel doesnt see my function. I right-clicked the worksheet and put the above in the view code section.
Thanks.