Info

Your code expected there to be a worksheet named Menu. For some reason, the client either accidentally deleted the worksheet or renamed it. As soon as you tried to select the sheet, you received an error:

Sub GetSettings()

ThisWorkbook.Worksheets("Menu").Select x = Range("A1").Value End Sub

This is a classic situation where you can't believe the client would do something so crazy. After you've been burned by this one a few times, you might go to these lengths to prevent an unhandled Debug error:

Sub GetSettings()

On Error Resume Next x = ThisWorkbook.Worksheets("Menu").Name If Not Err.Number = 0 Then

MsgBox "Expected to find a Menu worksheet, but it is missing" Exit Sub End If

On Error GoTo 0

ThisWorkbook.Worksheets("Menu").Select x = Range("A1").Value End Sub

0 0

Post a comment