By using expertatexcel.com you agree to our cookie policy, We and our partners operate globally and use cookies, for multiple purposes

expertatexcel.com

 


ShowSheet - udf - wraps the code to prevent errors

Used as a Wrapper function when going to a sheet and handling case if sheet is hidden.




Sub ShowSheet(Sh, Optional noStop)
On Error Resume Next
Sheets(Sh).Visble = True
Sheets(sh).Select
Sheets(sh).Activate

If Err <> 0 Then
    If IsMissing(noStop) Then
        Stop
    Else
        Exit Sub
    End If
End If

If Lcase(ActiveSheet.name <> LCase(sh) then
    If IsMissing(noStop) Then
        Stop
    Else
        Exit Sub
    End If
End If

End Sub