+ Reply to Thread
Results 1 to 7 of 7

copy sheets with a function

  1. #1
    Registered User
    Join Date
    03-11-2009
    Location
    Kansas
    MS-Off Ver
    Excel 2007
    Posts
    6

    copy sheets with a function

    Hey everyone, I could really use a little help here. Didn't get any replies to my last post, so I'm trying again, hopefully I can describe my problem a little better and entice someone to help out

    First off, wow I've never done so much crazy stuff with Excel! I'm kind of a newb I guess, but it is super powerful and awesome!

    My function JUST WONT WORK. I can't figure out why. It may be easier to understand my problem through the code, but in words I have a function that takes in a string, if a sheet by that name exists the function needs to return cell B3 of that sheet, if the sheet does NOT exist it needs to copy a template sheet - rename it to the string - then return cell B3.

    Here's my code so far:

    Please Login or Register  to view this content.
    I don't have the rename happening yet because i can't even get the copy to happen...

    Please help!!

  2. #2
    Forum Contributor
    Join Date
    08-02-2007
    Location
    Panama & Austria
    MS-Off Ver
    2003 & 2010
    Posts
    186

    Re: copy sheets with a function

    try the following:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    03-11-2009
    Location
    Kansas
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: copy sheets with a function

    No dice. The returned string is "#VALUE" and there are no new sheets...

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: copy sheets with a function

    You can't call the function from the worksheet; worksheet functions can only return values to the cells in which they appear, not modify any other part of the sheet or workbook.
    Entia non sunt multiplicanda sine necessitate

  5. #5
    Registered User
    Join Date
    03-11-2009
    Location
    Kansas
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: copy sheets with a function

    so is it possible to call a macro with an argument from inside the function? Thus i could create a macro that does the copy etc with the name I pull from the function?

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: copy sheets with a function

    You can call the function from a sub:
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    03-11-2009
    Location
    Kansas
    MS-Off Ver
    Excel 2007
    Posts
    6

    Re: copy sheets with a function

    but i don't want to have to run a macro every time something is changed... hm.. i don't like it. i'll have to restructure my approach. Thank you for your help!!

+ 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