+ Reply to Thread
Results 1 to 3 of 3

add worksheet in custom function

  1. #1
    Registered User
    Join Date

    add worksheet in custom function

    I'm trying to write a custom function that makes use of a temporary worksheet. To add a sheet in a regular sub procedure "Sheets.Add.Name = Temp" seems to work just fine. However, this doesn't work in my function. Is there another way to add a sheet while in a function? or is this something that functions inherently can't do? or am I just missing something completely?

    Thanks much.

  2. #2
    Forum Guru
    Join Date
    North America
    MS-Off Ver
    2002/XP and 2007
    What do you mean by "custom function?" A function procedure intended to be called from a worksheet cell (aka UDF)? If so, then this is the kind of operation a UDF is not allowed to do. You'll either have to stick with a Sub procedure or devise a completely different approach.

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Hello djoella,

    If you are referring to a User Defined Function then yes there are limitations. A UDF can only use the values of other cells and return a value to the cell it is attached to. Nor can you call a macro from within the UDF to modify the worksheet using VBA code.

    Leith Ross

+ Reply to Thread

Thread Information

Users Browsing this Thread

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


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