ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   crate formula in VBA (https://www.excelbanter.com/excel-programming/349975-crate-formula-vba.html)

Tadashii

crate formula in VBA
 

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.


--
Tadashii
------------------------------------------------------------------------
Tadashii's Profile: http://www.excelforum.com/member.php...o&userid=23918
View this thread: http://www.excelforum.com/showthread...hreadid=499650


Bob Phillips[_6_]

crate formula in VBA
 
Activecell.Formula = "=SUM(A1:A10)"

etc.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Tadashii" wrote in
message ...

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.


--
Tadashii
------------------------------------------------------------------------
Tadashii's Profile:

http://www.excelforum.com/member.php...o&userid=23918
View this thread: http://www.excelforum.com/showthread...hreadid=499650




NickHK

crate formula in VBA
 
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

"Tadashii" wrote in
message ...

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.


--
Tadashii
------------------------------------------------------------------------
Tadashii's Profile:

http://www.excelforum.com/member.php...o&userid=23918
View this thread: http://www.excelforum.com/showthread...hreadid=499650




Tadashii[_2_]

crate formula in VBA
 

That's exactly what i need thanks NickHK


--
Tadashii
------------------------------------------------------------------------
Tadashii's Profile: http://www.excelforum.com/member.php...o&userid=23918
View this thread: http://www.excelforum.com/showthread...hreadid=499650



All times are GMT +1. The time now is 01:12 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com