+ Reply to Thread
Results 1 to 3 of 3

Automating Tab names

  1. #1
    Stilla
    Guest

    Automating Tab names

    Hi.. On this site, I found this VBA code for naming tabs with entry in a
    particular cell, but it's not working... I only changed the "a2" part to
    correspond to my particular case, and left everything else alone. What
    could be wrong?
    __________
    Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target
    As Range)
    ActiveSheet.Name = Range("a2").Value
    End Sub
    ___________

    Thanks in advance


  2. #2
    Bob Phillips
    Guest

    Re: Automating Tab names

    That code needs to be in the Thisworkbook code module, and it should be

    Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
    If Target.Address = "$A$2" Then
    sh.Name = Target.Value
    End If
    End Sub


    --
    HTH

    Bob Phillips

    (remove xxx from email address if mailing direct)

    "Stilla" <Stilla@discussions.microsoft.com> wrote in message
    news:4884AA4F-0189-4BE0-AE0B-DCFD8BCE71B8@microsoft.com...
    > Hi.. On this site, I found this VBA code for naming tabs with entry in a
    > particular cell, but it's not working... I only changed the "a2" part to
    > correspond to my particular case, and left everything else alone. What
    > could be wrong?
    > __________
    > Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target
    > As Range)
    > ActiveSheet.Name = Range("a2").Value
    > End Sub
    > ___________
    >
    > Thanks in advance
    >




  3. #3
    Otto Moehrbach
    Guest

    Re: Automating Tab names

    Stilla
    Not sure of what you want to do. I think you want the name of each
    sheet to change to the value of A2 when that sheet is selected (activated).
    If this is so use this: Post back if this is not what you want. HTH
    Otto
    Private Sub Workbook_SheetActivate(ByVal Sh As Object)
    ActiveSheet.Name = Range("a2").Value
    End Sub
    "Stilla" <Stilla@discussions.microsoft.com> wrote in message
    news:4884AA4F-0189-4BE0-AE0B-DCFD8BCE71B8@microsoft.com...
    > Hi.. On this site, I found this VBA code for naming tabs with entry in a
    > particular cell, but it's not working... I only changed the "a2" part to
    > correspond to my particular case, and left everything else alone. What
    > could be wrong?
    > __________
    > Private Sub Workbook_SheetSelectionChange(ByVal Sh As Object, ByVal Target
    > As Range)
    > ActiveSheet.Name = Range("a2").Value
    > End Sub
    > ___________
    >
    > Thanks in advance
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1