can one write one's own Excel Function?

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
 
B

Bob Phillips

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)
 
B

Bob L.

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top