crate formula in VBA

  • Thread starter Thread starter Tadashii
  • Start date Start date
T

Tadashii

Hello,

is there a possibility to create an own formula in VBA, so that it can
be used in the spreadsheet like e.g. SUM(),TAN(), or ...

Thanks.
 
Activecell.Formula = "=SUM(A1:A10)"

etc.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
Tadashii,
You mean a User Defined Function (UDF) ?

In a Standard module, something like:
Public Function MyFunction (ArgIn As Long) As String
MyFunction = "You are " & ArgIn & " years old."
End Function

Then call it from a worksheet cell. e.g,
A1: =MyFunction(1000)

NickHK
 

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

Back
Top