+ Reply to Thread
Results 1 to 4 of 4

Public Functions As Worksheet Available Functions

  1. #1
    Steve King
    Guest

    Public Functions As Worksheet Available Functions

    I've created quite a few VBA functions which are invoked through the macros
    menu but would like to be able to build a function which can be invoked in
    the cell like a WorksheetFunction object. When I build the function and try
    to embed it into a cell with the '=FunctionName()' syntax I get an error. Is
    there a way to make my functions available?
    --
    Steve King

  2. #2
    Chip Pearson
    Guest

    Re: Public Functions As Worksheet Available Functions

    If you put the function in a regular code module (not a sheet
    module and not the ThisWorkbook module), you should be able to
    call them directly from worksheet cells. If the function resides
    in another workbook, you need to include the workbook name in the
    function call.


    --
    Cordially,
    Chip Pearson
    Microsoft MVP - Excel
    Pearson Software Consulting, LLC
    www.cpearson.com


    "Steve King" <[email protected]> wrote in
    message
    news:[email protected]...
    > I've created quite a few VBA functions which are invoked
    > through the macros
    > menu but would like to be able to build a function which can be
    > invoked in
    > the cell like a WorksheetFunction object. When I build the
    > function and try
    > to embed it into a cell with the '=FunctionName()' syntax I get
    > an error. Is
    > there a way to make my functions available?
    > --
    > Steve King




  3. #3
    Tom Ogilvy
    Guest

    Re: Public Functions As Worksheet Available Functions

    Make sure you place them in a General module (the type you get from
    Insert=>Module)

    Make sure they are not private.

    Public Function FunctionName()
    FunctionName = rnd()
    End function

    --
    Regards,
    Tom Ogilvy

    "Steve King" <[email protected]> wrote in message
    news:[email protected]...
    > I've created quite a few VBA functions which are invoked through the

    macros
    > menu but would like to be able to build a function which can be invoked in
    > the cell like a WorksheetFunction object. When I build the function and

    try
    > to embed it into a cell with the '=FunctionName()' syntax I get an error.

    Is
    > there a way to make my functions available?
    > --
    > Steve King




  4. #4
    Steve King
    Guest

    Re: Public Functions As Worksheet Available Functions

    Thanks Chip!

    I suspected it would be an easy answer but sometimes those are the most
    difficult to find in the documentation. I had a module for the add-in but
    obviously was not addressing it correctly.



    "Chip Pearson" wrote:

    > If you put the function in a regular code module (not a sheet
    > module and not the ThisWorkbook module), you should be able to
    > call them directly from worksheet cells. If the function resides
    > in another workbook, you need to include the workbook name in the
    > function call.
    >
    >
    > --
    > Cordially,
    > Chip Pearson
    > Microsoft MVP - Excel
    > Pearson Software Consulting, LLC
    > www.cpearson.com
    >
    >
    > "Steve King" <[email protected]> wrote in
    > message
    > news:[email protected]...
    > > I've created quite a few VBA functions which are invoked
    > > through the macros
    > > menu but would like to be able to build a function which can be
    > > invoked in
    > > the cell like a WorksheetFunction object. When I build the
    > > function and try
    > > to embed it into a cell with the '=FunctionName()' syntax I get
    > > an error. Is
    > > there a way to make my functions available?
    > > --
    > > Steve King

    >
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1