+ Reply to Thread
Results 1 to 8 of 8

Stop running the macro if sheet name matches

  1. #1
    Forum Contributor
    Join Date
    02-07-2011
    Location
    Bhutan
    MS-Off Ver
    Excel 2007
    Posts
    244

    Stop running the macro if sheet name matches

    Hi,
    I am using this macro to insert a new sheet and name it as Main.
    Please Login or Register  to view this content.
    I need the code to be modified a bit. So that

    1>if there exists a "Main" worksheet the code will not be executed (means no new sheet will be inserted" and will execute TRSS1009 function in the existing main sheet.
    2>if the "Main" sheet does not exists the code will be executed and then call this function: TRSD1723 and then TRSS1099

    Thanks in advance.
    Last edited by fatalcore; 07-09-2011 at 03:26 PM.

  2. #2
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Stop running the macro if sheet name matches

    Hi fatalcore, try
    Please Login or Register  to view this content.
    I don't know what you mean by calling the function though.
    If you're happy with someone's help, click that little star at the bottom left of their post to give them Reps.

    ---Keep on Coding in the Free World---

  3. #3
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Stop running the macro if sheet name matches

    Put this in a Standard Module
    Please Login or Register  to view this content.
    Then
    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  4. #4
    Forum Contributor
    Join Date
    02-07-2011
    Location
    Bhutan
    MS-Off Ver
    Excel 2007
    Posts
    244

    Re: Stop running the macro if sheet name matches

    Hi,
    1>Add a new sheet "Main"
    2>Insert a image from specific location.
    3>Run few calculation macros after that.

    Problem is if the main sheet exists i want the step 3 to be executed directly if not then step 1 then step 2 then step 3.

    Thanks in advance.
    Last edited by fatalcore; 07-09-2011 at 10:19 AM. Reason: Rectified quote tags to code tags.

  5. #5
    Forum Expert Mordred's Avatar
    Join Date
    07-06-2010
    Location
    Winnipeg, Canada
    MS-Off Ver
    2007, 2010
    Posts
    2,787

    Re: Stop running the macro if sheet name matches

    Hi fatalcore, when posting code, it is good practice to use code tags, not quote tags for wrapping around your code as per Rule3 in the Forum Rules

  6. #6
    Forum Contributor
    Join Date
    02-07-2011
    Location
    Bhutan
    MS-Off Ver
    Excel 2007
    Posts
    244

    Re: Stop running the macro if sheet name matches

    friends any help...

  7. #7
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Stop running the macro if sheet name matches

    Why haven't you tried the code that I posted/

  8. #8
    Forum Contributor
    Join Date
    02-07-2011
    Location
    Bhutan
    MS-Off Ver
    Excel 2007
    Posts
    244

    Re: Stop running the macro if sheet name matches

    Quote Originally Posted by royUK View Post
    Why haven't you tried the code that I posted/
    Thanks royUK and Mordred.

    I am getting error on mordred code. I mean 3 sheets are added even when I am pressing cancel.

    Even royUk's code is having a tiny problem . When I am pressing the cancel button I am getting an error,

    Please help ...Thanks a ton...
    Last edited by fatalcore; 07-09-2011 at 03:07 PM.

+ 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