ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Can I use a VBA function I write myself in a formula? (https://www.excelbanter.com/excel-programming/304631-can-i-use-vba-function-i-write-myself-formula.html)

David Laub

Can I use a VBA function I write myself in a formula?
 
Can I use a VBA function I write myself in a formula? It appears to be
impossibe...



Thanks

David Laub



Frank Kabel

Can I use a VBA function I write myself in a formula?
 
Hi
use a macro like

public function my_function()
my_function=1234
end function

and in a cell type:
=MY_FUNCTION()

See: http://www.mvps.org/dmcritchie/excel/getstarted.htm

--
Regards
Frank Kabel
Frankfurt, Germany

"David Laub" schrieb im Newsbeitrag
...
Can I use a VBA function I write myself in a formula? It appears to

be
impossibe...



Thanks

David Laub




David Laub

Can I use a VBA function I write myself in a formula?
 
When I try this, I get a "Invalid Name' error in Excel - i can use built in
function and named cells fine

Is there some sort of subtle scoping/fully qualified name" issue


"Frank Kabel" wrote in message
...
Hi
use a macro like

public function my_function()
my_function=1234
end function

and in a cell type:
=MY_FUNCTION()

See: http://www.mvps.org/dmcritchie/excel/getstarted.htm

--
Regards
Frank Kabel
Frankfurt, Germany

"David Laub" schrieb im Newsbeitrag
...
Can I use a VBA function I write myself in a formula? It appears to

be
impossibe...



Thanks

David Laub






Frank Kabel

Can I use a VBA function I write myself in a formula?
 
Hi
where did you put this code?. It has to go in a standard module (see
the link I provided to you)

--
Regards
Frank Kabel
Frankfurt, Germany

"David Laub" schrieb im Newsbeitrag
...
When I try this, I get a "Invalid Name' error in Excel - i can use

built in
function and named cells fine

Is there some sort of subtle scoping/fully qualified name" issue


"Frank Kabel" wrote in message
...
Hi
use a macro like

public function my_function()
my_function=1234
end function

and in a cell type:
=MY_FUNCTION()

See: http://www.mvps.org/dmcritchie/excel/getstarted.htm

--
Regards
Frank Kabel
Frankfurt, Germany

"David Laub" schrieb im Newsbeitrag
...
Can I use a VBA function I write myself in a formula? It appears

to
be
impossibe...



Thanks

David Laub







David Laub

Can I use a VBA function I write myself in a formula?
 
Thanks again - I originally placed it in Sheet1 object instead of a New
Module

P.S. I read your note for listing User Defined Functions, but I don't know
how to "see" the Function Wizard list - can you help me even more?

Thanks
"Frank Kabel" wrote in message
...
Hi
where did you put this code?. It has to go in a standard module (see
the link I provided to you)

--
Regards
Frank Kabel
Frankfurt, Germany

"David Laub" schrieb im Newsbeitrag
...
When I try this, I get a "Invalid Name' error in Excel - i can use

built in
function and named cells fine

Is there some sort of subtle scoping/fully qualified name" issue


"Frank Kabel" wrote in message
...
Hi
use a macro like

public function my_function()
my_function=1234
end function

and in a cell type:
=MY_FUNCTION()

See: http://www.mvps.org/dmcritchie/excel/getstarted.htm

--
Regards
Frank Kabel
Frankfurt, Germany

"David Laub" schrieb im Newsbeitrag
...
Can I use a VBA function I write myself in a formula? It appears

to
be
impossibe...



Thanks

David Laub









David Laub

Can I use a VBA function I write myself in a formula?
 
Here's a bonus question: Thanks to your tip, I can invoke a User Defined
Function to populate a cell!
What I'd really love to do additionally is invoke a User Defined function as
part of formula based custom Data Validation - when I try this on a UDF that
works great as a formula cell value, I get a "can't find named range"
error - i.e. the Data Validation dialog is not understanding that the name
of my function is a user defined function - I can enter built-in function
names, or named cells, but (so far) I can't enter a user defined function

Thanks again

"Frank Kabel" wrote in message
...
Hi
where did you put this code?. It has to go in a standard module (see
the link I provided to you)

--
Regards
Frank Kabel
Frankfurt, Germany

"David Laub" schrieb im Newsbeitrag
...
When I try this, I get a "Invalid Name' error in Excel - i can use

built in
function and named cells fine

Is there some sort of subtle scoping/fully qualified name" issue


"Frank Kabel" wrote in message
...
Hi
use a macro like

public function my_function()
my_function=1234
end function

and in a cell type:
=MY_FUNCTION()

See: http://www.mvps.org/dmcritchie/excel/getstarted.htm

--
Regards
Frank Kabel
Frankfurt, Germany

"David Laub" schrieb im Newsbeitrag
...
Can I use a VBA function I write myself in a formula? It appears

to
be
impossibe...



Thanks

David Laub









Frank Kabel

Can I use a VBA function I write myself in a formula?
 
Hi
AFAIK you can't use UDFs within Data Validation. Just an Excel
restriction!

--
Regards
Frank Kabel
Frankfurt, Germany

"David Laub" schrieb im Newsbeitrag
...
Here's a bonus question: Thanks to your tip, I can invoke a User

Defined
Function to populate a cell!
What I'd really love to do additionally is invoke a User Defined

function as
part of formula based custom Data Validation - when I try this on a

UDF that
works great as a formula cell value, I get a "can't find named range"
error - i.e. the Data Validation dialog is not understanding that the

name
of my function is a user defined function - I can enter built-in

function
names, or named cells, but (so far) I can't enter a user defined

function

Thanks again

"Frank Kabel" wrote in message
...
Hi
where did you put this code?. It has to go in a standard module

(see
the link I provided to you)

--
Regards
Frank Kabel
Frankfurt, Germany

"David Laub" schrieb im Newsbeitrag
...
When I try this, I get a "Invalid Name' error in Excel - i can

use
built in
function and named cells fine

Is there some sort of subtle scoping/fully qualified name" issue


"Frank Kabel" wrote in message
...
Hi
use a macro like

public function my_function()
my_function=1234
end function

and in a cell type:
=MY_FUNCTION()

See: http://www.mvps.org/dmcritchie/excel/getstarted.htm

--
Regards
Frank Kabel
Frankfurt, Germany

"David Laub" schrieb im Newsbeitrag
...
Can I use a VBA function I write myself in a formula? It

appears
to
be
impossibe...



Thanks

David Laub










David Laub

Can I use a VBA function I write myself in a formula?
 
Thanks - I'll stop spinning my wheels on that one!!!
"Frank Kabel" wrote in message
...
Hi
AFAIK you can't use UDFs within Data Validation. Just an Excel
restriction!

--
Regards
Frank Kabel
Frankfurt, Germany

"David Laub" schrieb im Newsbeitrag
...
Here's a bonus question: Thanks to your tip, I can invoke a User

Defined
Function to populate a cell!
What I'd really love to do additionally is invoke a User Defined

function as
part of formula based custom Data Validation - when I try this on a

UDF that
works great as a formula cell value, I get a "can't find named range"
error - i.e. the Data Validation dialog is not understanding that the

name
of my function is a user defined function - I can enter built-in

function
names, or named cells, but (so far) I can't enter a user defined

function

Thanks again

"Frank Kabel" wrote in message
...
Hi
where did you put this code?. It has to go in a standard module

(see
the link I provided to you)

--
Regards
Frank Kabel
Frankfurt, Germany

"David Laub" schrieb im Newsbeitrag
...
When I try this, I get a "Invalid Name' error in Excel - i can

use
built in
function and named cells fine

Is there some sort of subtle scoping/fully qualified name" issue


"Frank Kabel" wrote in message
...
Hi
use a macro like

public function my_function()
my_function=1234
end function

and in a cell type:
=MY_FUNCTION()

See: http://www.mvps.org/dmcritchie/excel/getstarted.htm

--
Regards
Frank Kabel
Frankfurt, Germany

"David Laub" schrieb im Newsbeitrag
...
Can I use a VBA function I write myself in a formula? It

appears
to
be
impossibe...



Thanks

David Laub












Norman Jones

Can I use a VBA function I write myself in a formula?
 

Hi Frank,

I believe, however, that you can use a data validation formula that refers
to a cell that uses the UDF.


---
Regards,
Norman


"Frank Kabel" wrote in message
...
Hi
AFAIK you can't use UDFs within Data Validation. Just an Excel
restriction!

--
Regards
Frank Kabel
Frankfurt, Germany

"David Laub" schrieb im Newsbeitrag
...
Here's a bonus question: Thanks to your tip, I can invoke a User

Defined
Function to populate a cell!
What I'd really love to do additionally is invoke a User Defined

function as
part of formula based custom Data Validation - when I try this on a

UDF that
works great as a formula cell value, I get a "can't find named range"
error - i.e. the Data Validation dialog is not understanding that the

name
of my function is a user defined function - I can enter built-in

function
names, or named cells, but (so far) I can't enter a user defined

function

Thanks again

"Frank Kabel" wrote in message
...
Hi
where did you put this code?. It has to go in a standard module

(see
the link I provided to you)

--
Regards
Frank Kabel
Frankfurt, Germany

"David Laub" schrieb im Newsbeitrag
...
When I try this, I get a "Invalid Name' error in Excel - i can

use
built in
function and named cells fine

Is there some sort of subtle scoping/fully qualified name" issue


"Frank Kabel" wrote in message
...
Hi
use a macro like

public function my_function()
my_function=1234
end function

and in a cell type:
=MY_FUNCTION()

See: http://www.mvps.org/dmcritchie/excel/getstarted.htm

--
Regards
Frank Kabel
Frankfurt, Germany

"David Laub" schrieb im Newsbeitrag
...
Can I use a VBA function I write myself in a formula? It

appears
to
be
impossibe...



Thanks

David Laub












Frank Kabel

Can I use a VBA function I write myself in a formula?
 
Hi Norman
correct. This would be a workaround - just forgot it :-)

--
Regards
Frank Kabel
Frankfurt, Germany

"Norman Jones" schrieb im Newsbeitrag
...

Hi Frank,

I believe, however, that you can use a data validation formula that

refers
to a cell that uses the UDF.


---
Regards,
Norman


"Frank Kabel" wrote in message
...
Hi
AFAIK you can't use UDFs within Data Validation. Just an Excel
restriction!

--
Regards
Frank Kabel
Frankfurt, Germany

"David Laub" schrieb im Newsbeitrag
...
Here's a bonus question: Thanks to your tip, I can invoke a User

Defined
Function to populate a cell!
What I'd really love to do additionally is invoke a User Defined

function as
part of formula based custom Data Validation - when I try this on

a
UDF that
works great as a formula cell value, I get a "can't find named

range"
error - i.e. the Data Validation dialog is not understanding that

the
name
of my function is a user defined function - I can enter built-in

function
names, or named cells, but (so far) I can't enter a user defined

function

Thanks again

"Frank Kabel" wrote in message
...
Hi
where did you put this code?. It has to go in a standard module

(see
the link I provided to you)

--
Regards
Frank Kabel
Frankfurt, Germany

"David Laub" schrieb im Newsbeitrag
...
When I try this, I get a "Invalid Name' error in Excel - i

can
use
built in
function and named cells fine

Is there some sort of subtle scoping/fully qualified name"

issue


"Frank Kabel" wrote in message
...
Hi
use a macro like

public function my_function()
my_function=1234
end function

and in a cell type:
=MY_FUNCTION()

See: http://www.mvps.org/dmcritchie/excel/getstarted.htm

--
Regards
Frank Kabel
Frankfurt, Germany

"David Laub" schrieb im Newsbeitrag
...
Can I use a VBA function I write myself in a formula? It

appears
to
be
impossibe...



Thanks

David Laub














All times are GMT +1. The time now is 02:17 PM.

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