ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Create "Name" in UDF (https://www.excelbanter.com/excel-programming/354982-create-name-udf.html)

Peter

Create "Name" in UDF
 
Hi,

I want to create a UDF, and then in my VBA I create a "Name" for the calling
cell, is it possible?

E.g. =GetTotal ( my UDF will return a VALUE, as well as name "that" cell as
"SomeText")

Thanks,

Norman Jones

Create "Name" in UDF
 
Hi Peter,

A UDF returns a value to the calling cell; it cannot alter its environment.

If you want to name a cell, you will need to use an appropriate sub.


---
Regards,
Norman



"Peter" wrote in message
...
Hi,

I want to create a UDF, and then in my VBA I create a "Name" for the
calling
cell, is it possible?

E.g. =GetTotal ( my UDF will return a VALUE, as well as name "that" cell
as
"SomeText")

Thanks,




Chris Marlow

Create "Name" in UDF
 
Hi,

I can't see how you can do it directly in the function, as you can't pass
the cell as a parameter (you get a circular reference).

However you could trap the 'Worksheet_Change' event on a worksheet & set
names up depending on if the Target returned contained you type of formula
.... not what you want but it may be a work-around.

Regards,

Chris.

--
Chris Marlow
MCSD.NET, Microsoft Office XP Master


"Peter" wrote:

Hi,

I want to create a UDF, and then in my VBA I create a "Name" for the calling
cell, is it possible?

E.g. =GetTotal ( my UDF will return a VALUE, as well as name "that" cell as
"SomeText")

Thanks,



All times are GMT +1. The time now is 02:36 AM.

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