PC Review


Reply
Thread Tools Rate Thread

How to create a function via VBA?

 
 
Melker Sandberg
Guest
Posts: n/a
 
      14th Nov 2006
Hi everyone,



I would appreciate some hints on how make a VBA "program" accessible from a
sheet function.



I would like to be able to crate a function in VBA and then be able to use
it as a function in a sheet...something like..... =my.function(A1:B7)



Does someone, have any ideas?



Thank you in advance



Melker





 
Reply With Quote
 
 
 
 
Kweenie
Guest
Posts: n/a
 
      14th Nov 2006

For using a function in a sheet you gave the answer yourself.

Piet

Melker Sandberg schreef:

> Hi everyone,
>
>
>
> I would appreciate some hints on how make a VBA "program" accessible from a
> sheet function.
>
>
>
> I would like to be able to crate a function in VBA and then be able to use
> it as a function in a sheet...something like..... =my.function(A1:B7)
>
>
>
> Does someone, have any ideas?
>
>
>
> Thank you in advance
>
>
>
> Melker


 
Reply With Quote
 
Melker Sandberg
Guest
Posts: n/a
 
      14th Nov 2006
I´m sorry but i do not understand.
The idea is that i want to create a new function that does not excist in
Excel and then name it so that i can use it in a sheet as an "ordinary"
function like =sum() or something.

/Melker

"Kweenie" <(E-Mail Removed)> skrev i meddelandet
news:(E-Mail Removed)...
>
> For using a function in a sheet you gave the answer yourself.
>
> Piet
>
> Melker Sandberg schreef:
>
>> Hi everyone,
>>
>>
>>
>> I would appreciate some hints on how make a VBA "program" accessible from
>> a
>> sheet function.
>>
>>
>>
>> I would like to be able to crate a function in VBA and then be able to
>> use
>> it as a function in a sheet...something like..... =my.function(A1:B7)
>>
>>
>>
>> Does someone, have any ideas?
>>
>>
>>
>> Thank you in advance
>>
>>
>>
>> Melker

>



 
Reply With Quote
 
Melker Sandberg
Guest
Posts: n/a
 
      14th Nov 2006
I´m sorry but i do not understand.
The idea is that i want to create a new function that does not excist in
Excel and then name it so that i can use it in a sheet as an "ordinary"
function like =sum() or something.

/Melker

"Kweenie" <(E-Mail Removed)> skrev i meddelandet
news:(E-Mail Removed)...
>
> For using a function in a sheet you gave the answer yourself.
>
> Piet
>
> Melker Sandberg schreef:
>
>> Hi everyone,
>>
>>
>>
>> I would appreciate some hints on how make a VBA "program" accessible from
>> a
>> sheet function.
>>
>>
>>
>> I would like to be able to crate a function in VBA and then be able to
>> use
>> it as a function in a sheet...something like..... =my.function(A1:B7)
>>
>>
>>
>> Does someone, have any ideas?
>>
>>
>>
>> Thank you in advance
>>
>>
>>
>> Melker

>



 
Reply With Quote
 
Kweenie
Guest
Posts: n/a
 
      14th Nov 2006
Just as i told you before.

Once you have made the function, let's name him
"Function Test()", you can type in a cel " =Test()" and the function
will execute.

Piet


Melker Sandberg schreef:

> I´m sorry but i do not understand.
> The idea is that i want to create a new function that does not excist in
> Excel and then name it so that i can use it in a sheet as an "ordinary"
> function like =sum() or something.
>
> /Melker
>
> "Kweenie" <(E-Mail Removed)> skrev i meddelandet
> news:(E-Mail Removed)...
> >
> > For using a function in a sheet you gave the answer yourself.
> >
> > Piet
> >
> > Melker Sandberg schreef:
> >
> >> Hi everyone,
> >>
> >>
> >>
> >> I would appreciate some hints on how make a VBA "program" accessible from
> >> a
> >> sheet function.
> >>
> >>
> >>
> >> I would like to be able to crate a function in VBA and then be able to
> >> use
> >> it as a function in a sheet...something like..... =my.function(A1:B7)
> >>
> >>
> >>
> >> Does someone, have any ideas?
> >>
> >>
> >>
> >> Thank you in advance
> >>
> >>
> >>
> >> Melker

> >


 
Reply With Quote
 
Melker Sandberg
Guest
Posts: n/a
 
      14th Nov 2006
Aha, now i get it! I´ll try it and see what happens.

Thank you
Melker


"Kweenie" <(E-Mail Removed)> skrev i meddelandet
news:(E-Mail Removed)...
Just as i told you before.

Once you have made the function, let's name him
"Function Test()", you can type in a cel " =Test()" and the function
will execute.

Piet


Melker Sandberg schreef:

> I´m sorry but i do not understand.
> The idea is that i want to create a new function that does not excist in
> Excel and then name it so that i can use it in a sheet as an "ordinary"
> function like =sum() or something.
>
> /Melker
>
> "Kweenie" <(E-Mail Removed)> skrev i meddelandet
> news:(E-Mail Removed)...
> >
> > For using a function in a sheet you gave the answer yourself.
> >
> > Piet
> >
> > Melker Sandberg schreef:
> >
> >> Hi everyone,
> >>
> >>
> >>
> >> I would appreciate some hints on how make a VBA "program" accessible
> >> from
> >> a
> >> sheet function.
> >>
> >>
> >>
> >> I would like to be able to crate a function in VBA and then be able to
> >> use
> >> it as a function in a sheet...something like..... =my.function(A1:B7)
> >>
> >>
> >>
> >> Does someone, have any ideas?
> >>
> >>
> >>
> >> Thank you in advance
> >>
> >>
> >>
> >> Melker

> >



 
Reply With Quote
 
Kweenie
Guest
Posts: n/a
 
      14th Nov 2006
Here's an example how to use it

Copy into a module

Function TestMacro()
MsgBox ActiveWorkbook.Name
End Function

type in A1 =IF(A2=2;Testmacro();"")

type in A2 "2" (Without " ")


Piet


Melker Sandberg schreef:

> Aha, now i get it! I´ll try it and see what happens.
>
> Thank you
> Melker
>
>
> "Kweenie" <(E-Mail Removed)> skrev i meddelandet
> news:(E-Mail Removed)...
> Just as i told you before.
>
> Once you have made the function, let's name him
> "Function Test()", you can type in a cel " =Test()" and the function
> will execute.
>
> Piet
>
>
> Melker Sandberg schreef:
>
> > I´m sorry but i do not understand.
> > The idea is that i want to create a new function that does not excist in
> > Excel and then name it so that i can use it in a sheet as an "ordinary"
> > function like =sum() or something.
> >
> > /Melker
> >
> > "Kweenie" <(E-Mail Removed)> skrev i meddelandet
> > news:(E-Mail Removed)...
> > >
> > > For using a function in a sheet you gave the answer yourself.
> > >
> > > Piet
> > >
> > > Melker Sandberg schreef:
> > >
> > >> Hi everyone,
> > >>
> > >>
> > >>
> > >> I would appreciate some hints on how make a VBA "program" accessible
> > >> from
> > >> a
> > >> sheet function.
> > >>
> > >>
> > >>
> > >> I would like to be able to crate a function in VBA and then be able to
> > >> use
> > >> it as a function in a sheet...something like..... =my.function(A1:B7)
> > >>
> > >>
> > >>
> > >> Does someone, have any ideas?
> > >>
> > >>
> > >>
> > >> Thank you in advance
> > >>
> > >>
> > >>
> > >> Melker
> > >


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create a function FrozenRope Microsoft Excel Worksheet Functions 2 25th Nov 2008 12:20 AM
How to create a function? leungkong Microsoft Excel Programming 2 15th Aug 2008 04:46 AM
Create Function like Sum() Yap Michael Microsoft Excel Programming 1 13th Jan 2006 04:12 AM
How do I create a function into function list? =?Utf-8?B?SG9zc2VpbiBGYXJoYW5p?= Microsoft Excel Programming 2 23rd Apr 2005 06:19 PM
How to Create a Function Point for a class member function. Microsoft Microsoft VC .NET 2 13th Aug 2004 09:00 AM


Features
 

Advertising
 

Newsgroups
 


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