Home Excel Powerpoint Word Outlook Error Codes

VBA Useful Codes

Welcome to the World of VBA
Home > VBAUsefulCodes

Check Sheet Name Exist

Before we do any activity into a sheet, we sometimes need to check that specific sheet is exist or not. This code help you to check the sheet name provided is exist or not.

Sub check_shtname()
    MsgBox Sheet_Exist("Sheet1")
End Sub

Function Sheet_Exist(shtname As String)
    Dim WS
    For Each WS In Excel.Worksheets
        If WS.Name = shtname Then
            Sheet_Exist = "Sheet Exist"
            Exit Function
        End If
    Sheet_Exist = "Sheet Not Exist"
End Function


Enter your e-mail below and get notified on the latest blog posts.


VBA Outlook KPI Excel Alt+F11 Dashboards Macros Recording Graphs Automation Developer WaterFall Powerpoint Charts Pivot Tables Forecast Charts

Follow Us