Hello,

Here is what I need help with:

The app I'm working on is used quarterly. For this procedure I want to check the current file and see if the worksheet 'Proposed' exists. If it does exist, then I want to delete it. If it doesn't exist, I want to add it. Eventually (not in this sub) I want to open up another excel file that the user has designated and then copy the values from that file into the worksheet that I have created.

For some reason or another, the below code is choking. I keep getting a Run-Time Error '9': Subscript out of range. It chokes on the first line Set WsA = Sheets("Proposed").

Any help would be greatly appreciated.

-js999


Sub Does_Proposed_Ws_Exist()

    Dim wsA As Worksheet
    
    Set wsA = Sheets("Proposed")    
    'Find worksheet
    If wsA Is Nothing Then
        'Proposed doesn't exist
        MsgBox "Worksheet does not exist."
        Set wsA = Nothing
        
        'Insert into Report file sheet named "Proposed"
        Sheets.Add.Name = "Proposed"
    Else
        'Ws exists, lets delete it and insert a new one to have a 'clean' file
        Set wsA = Nothing
        
        ActiveWorkbook.Sheets("Proposed").Activate
        
        Application.DisplayAlerts = False       'Disable alert when deleting wksheet
        For Each wsA In ThisWorkbook.Worksheets
            If wsA.Name = "Proposed" Then
                wsA.Delete
            End If
        Next
        Application.DisplayAlerts = True        'Enable alerts again
        Sheets.Add.Name = "Proposed"
    End If

End Sub