ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Function in VBA (https://www.excelbanter.com/excel-programming/300978-function-vba.html)

Christopher Brooks

Function in VBA
 
When I write a function into any of the Excell objects in
VBA as follows:

Function Bird()
End Function

then type

=Bird()

into the spread sheet, it does not see the function.

When I debug the function, I get the following error
message:

Object library invalid or contains references to object
definitions that could not be found.

What is going on here? Isn't a function supposed to work
in the spreadsheet?

-cnb

keepITcool

Function in VBA
 
'any of the excel objects' is crucial here...
these are 'object modules' and work differently from normal code modules

insert a standard module.
type or copy your code there

et voila!





keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Christopher Brooks" wrote:

When I write a function into any of the Excell objects in
VBA as follows:

Function Bird()
End Function

then type

=Bird()

into the spread sheet, it does not see the function.

When I debug the function, I get the following error
message:

Object library invalid or contains references to object
definitions that could not be found.

What is going on here? Isn't a function supposed to work
in the spreadsheet?

-cnb



Frank Kabel

Function in VBA
 
Hi Christopher
you have probably inserted this piece of code in a workbook or
worksheet module instead of a standard module

--
Regards
Frank Kabel
Frankfurt, Germany


Christopher Brooks wrote:
When I write a function into any of the Excell objects in
VBA as follows:

Function Bird()
End Function

then type

=Bird()

into the spread sheet, it does not see the function.

When I debug the function, I get the following error
message:

Object library invalid or contains references to object
definitions that could not be found.

What is going on here? Isn't a function supposed to work
in the spreadsheet?

-cnb



Christopher Brooks[_2_]

Function in VBA
 

-----Original Message-----
'any of the excel objects' is crucial here...
these are 'object modules' and work differently from

normal code modules

insert a standard module.
type or copy your code there

et voila!


et voila, indeed! Thank you very much. I have the feeling
that I may be returning to this forum.

-cnb


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

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