can one write one's own Excel Function?

  • Thread starter Thread starter Elliott Baral
  • Start date Start date
E

Elliott Baral

Can one write one's own Excel Function?
For example, suppose I've got calendar dates in one column,
and I want to translate them to Italian in another column.
The Italian translation should change automatically when
I change the calendar date. The "Italian column" would be
coded something like =Italian(F3).

Is there any way to do this?

- Elliott Baral
 
Elliott,

Yes, just call the procedure Function instead of Sub. A simple example is

Function inc(rng as Range)

if rng.Count > 1 Then
CvErr(xlErrValue)
Exit Function
End If

inc= rng.Value + 1

End Function

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Yes, of course. For example open VBA, insert a module and then insert this
in the module

Function french(myword)
Select Case myword
Case Is = "oui"
french = "yes"
Case Is = "merci"
french = "Thank you"
Case Else
french = "Beats me!"
End Select
End Function
 
Back
Top