+ Reply to Thread
Results 1 to 3 of 3

Help with If Then Else Statement

Hybrid View

  1. #1
    Registered User
    Join Date
    03-15-2012
    Location
    Jefferson City, Missouri
    MS-Off Ver
    Excel 2010
    Posts
    31

    Help with If Then Else Statement

    I'm needing some help with the macro below. I'm not sure why this will not work correctly. If the ActiveSheet is a certain "bracket" then I need it to run the corresponding macro only. I first tried it with IF instead of ELSEIF before each condition, but it ran all the macros. Now it won't run any of them. I'm probably missing something easy, but I can't figure it out. I would truly appreciate some help with this.

    Sub Reset()
    
    On Error Resume Next
    
        Dim Response As Integer
        Response = MsgBox(prompt:="WARNING!  Are you absolutely, positively SURE you want to RESET ???", Buttons:=vbYesNo)
        If Response = vbNo Then MsgBox "WOW, that was close!"
        If Response = vbYes Then
          On Error Resume Next
        Application.ScreenUpdating = False
            If ActiveSheet = ("4Man_Bracket") Then Application.Run ("Record4ManWinners")
            ElseIf ActiveSheet = ("4Ladies_Bracket")  Then Application.Run ("Record4LadiesWinners")
            ElseIf ActiveSheet = ("Mens_Dbls_Bracket") Then Application.Run ("RecordMensDblsWinners")
            ElseIf ActiveSheet = ("Ladies_Dbls_Bracket") Then Application.Run ("RecordLadiesDblsWinners")
            ElseIf ActiveSheet = ("Mixed_Trips_Bracket") Then Application.Run ("RecordMixedTripsWinners")
            ElseIf ActiveSheet = ("Mens_Single_Bracket") Then Application.Run ("RecordMensSingleWinners")
            ElseIf ActiveSheet = ("Ladies_Single_Bracket") Then Application.Run ("RecordLadiesSingleWinners")
            End If
    
    ' Then the rest of the macro runs from here....
    Thank you for any help you can offer to get me over this bump!

  2. #2
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Help with If Then Else Statement

    Not a VBA guy but I think you need ActiveSheet.Name

  3. #3
    Registered User
    Join Date
    03-15-2012
    Location
    Jefferson City, Missouri
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: Help with If Then Else Statement

    It appears that was the problem. Thank you so much for your prompt response!

+ 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