ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Is it possible with functions? (https://www.excelbanter.com/excel-discussion-misc-queries/95791-possible-functions.html)

compound

Is it possible with functions?
 

Great Day!
I have a user defined function in a cell A1 and I would like to return
value to the cell B2

For example if I have function:

Public Function MyTest(ByVal sInput As String)
Application.Range("MyRange") = sInput
End Function

If I put this function in to cell A1 and name cell B2 “MyRange” then I
get an application error.

Thank you.
Compound.


--
compound
------------------------------------------------------------------------
compound's Profile: http://www.excelforum.com/member.php...o&userid=11556
View this thread: http://www.excelforum.com/showthread...hreadid=555131


Elkar

Is it possible with functions?
 
No, a function (user-defined or not) can only return a value to the cell that
it is used in. A Workbook SheetChange event macro may accomplish what you're
looking for, but not a function.

Its not clear what you're trying to accomplish, but why not place a formula
in B2 that performs a calculation on data in A1? Would this not give you
your desired results?

HTH,
Elkar


"compound" wrote:


Great Day!
I have a user defined function in a cell A1 and I would like to return
value to the cell B2

For example if I have function:

Public Function MyTest(ByVal sInput As String)
Application.Range("MyRange") = sInput
End Function

If I put this function in to cell A1 and name cell B2 €śMyRange€ť then I
get an application error.

Thank you.
Compound.


--
compound
------------------------------------------------------------------------
compound's Profile: http://www.excelforum.com/member.php...o&userid=11556
View this thread: http://www.excelforum.com/showthread...hreadid=555131




All times are GMT +1. The time now is 01:27 AM.

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