+ Reply to Thread
Results 1 to 4 of 4

Run If statement based on SheetName

  1. #1
    Registered User
    Join Date
    06-28-2007
    Posts
    27

    Run If statement based on SheetName

    I'm trying to run an If statement that can only run if the worksheet exists.
    Any help would be much appreciated.

    Below is my code:

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,565
    Hi there,

    Let me know if the following meets your needs:

    Please Login or Register  to view this content.
    HTH

    Robert

  3. #3
    Registered User
    Join Date
    06-28-2007
    Posts
    27

    Thank!

    Robert,

    Thanks for your help. The code definitely works.

    I have a macro for each month of the year with a number of formulas that are calculated monthly on the worksheet, if it exists. However, when I tried to incorporate all of these macros into one, it only gives me the formulas for the very first worksheet it finds. I'm thinking that I will need a For Loop to search for the worksheet and if it exists, then it will calculate the formulas. Let me know what you think.

    In the code I've included below, I'm trying to calculate the formulas for the previous months. Yet, if June is found, it will only compute June's formulas rather than do April, May, June, etc.

    Thanks for all your help.

    J.

    Please Login or Register  to view this content.

  4. #4
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,565
    Hi there,

    Glad to hear the macro worked (well almost).

    It's probably a bit 'clunky', but see if the following does the trick - I've adjusted each of the 12 formulas based on the example you provided, change them if they don't suit:

    Please Login or Register  to view this content.
    HTH

    Robert

+ 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