Consulting

Results 1 to 2 of 2

Thread: Checking Tab Names

  1. #1
    VBAX Regular
    Joined
    Sep 2009
    Posts
    57
    Location

    Checking Tab Names

    Is there a way of checking the tab names when a command button is clicked. what i want to do is sheck to see if there is a tab with the same name as the sheet that it is trying to generate. if there is then a message box will let the user know that the tab name is taken.

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Build a Function that tells you

    [vba]

    '-----------------------------------------------------------------
    Function SheetExists(Sh As String, _
    Optional wb As Workbook) As Boolean
    '-----------------------------------------------------------------
    Dim oWs As Worksheet
    If wb Is Nothing Then Set wb = ActiveWorkbook
    On Error Resume Next
    SheetExists = CBool(Not wb.Worksheets(Sh) Is Nothing)
    On Error GoTo 0
    End Function
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •