+ Reply to Thread
Results 1 to 4 of 4

Naming Tabs

  1. #1
    ebro
    Guest

    Naming Tabs

    Is there any way to force the tab name to be a cell in the worksheet?

  2. #2
    JMB
    Guest

    RE: Naming Tabs

    Right click on the tab and paste this code in. Change cell reference as
    needed. I would probably name the cell then change Range("A1") to
    Range("TabName") where "TabName" is the name of the cell. Invalid sheet
    names are ignored.

    Private Sub Worksheet_Change(ByVal Target As Range)
    On Error Resume Next
    Me.Name = Range("A1").Value
    End Sub

    "ebro" wrote:

    > Is there any way to force the tab name to be a cell in the worksheet?


  3. #3
    ebro
    Guest

    RE: Naming Tabs

    So I need to right click and select "View Code"? Then paste the new code?

    "JMB" wrote:

    > Right click on the tab and paste this code in. Change cell reference as
    > needed. I would probably name the cell then change Range("A1") to
    > Range("TabName") where "TabName" is the name of the cell. Invalid sheet
    > names are ignored.
    >
    > Private Sub Worksheet_Change(ByVal Target As Range)
    > On Error Resume Next
    > Me.Name = Range("A1").Value
    > End Sub
    >
    > "ebro" wrote:
    >
    > > Is there any way to force the tab name to be a cell in the worksheet?


  4. #4
    JMB
    Guest

    RE: Naming Tabs

    Yes, I forgot that step. It is an event macro that will fire when the sheet
    changes. You won't be able to change the sheet name w/o using VBA.

    The reason for naming the cell (post back if you're unfamiliar w/naming
    cells in Excel) is so that if it moves (by inserting/deleting rows or
    columns, cutting/pasting, etc), VBA will still be able to find it. If you
    use a cell reference in VBA (such as A1), it will always refer to A1, even if
    the contents of A1 is moved to another cell.


    "ebro" wrote:

    > So I need to right click and select "View Code"? Then paste the new code?
    >
    > "JMB" wrote:
    >
    > > Right click on the tab and paste this code in. Change cell reference as
    > > needed. I would probably name the cell then change Range("A1") to
    > > Range("TabName") where "TabName" is the name of the cell. Invalid sheet
    > > names are ignored.
    > >
    > > Private Sub Worksheet_Change(ByVal Target As Range)
    > > On Error Resume Next
    > > Me.Name = Range("A1").Value
    > > End Sub
    > >
    > > "ebro" wrote:
    > >
    > > > Is there any way to force the tab name to be a cell in the worksheet?


+ 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