Results 1 to 8 of 8

Stop running the macro if sheet name matches

Threaded View

  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.
    Sub InsertIndex()
    On Error GoTo ErrHandler:
        Dim SheetName As String
        On Error Resume Next
        SheetName = InputBox("Enter new name of Worksheet", "Sheet Info.", "Main")
    Sheets.Add
    ActiveSheet.Name = SheetName
    ErrHandler:
         Resume Next
    End Sub
    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.

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