+ Reply to Thread
Results 1 to 4 of 4

Automatically Update Sheet Names

  1. #1
    Steve
    Guest

    Automatically Update Sheet Names

    Hi All,

    Does anybody know how I can automatically name the sheets of a workbook
    based on the contents of a cell. For example, if I have the word January in
    Cell A:1, I would like the Sheet name to be January. If I change January
    to May, I would like the sheet to automatically update and rename itself to
    May.

    Any ideas?

    Thanks,

    Steve



  2. #2
    Norman Jones
    Guest

    Re: Automatically Update Sheet Names

    Hi Steve,
    Try:
    '==================>>
    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim rng As Range

    Set rng = Range("A1")

    On Error Resume Next
    If Not Intersect(Target, rng) Is Nothing Then
    If Not IsEmpty(rng) Then
    Sheet2.Name = rng.Value
    End If
    End If
    On Error GoTo 0

    End Sub
    '<<==================



    ---
    Regards,
    Norman



    "Steve" <[email protected]> wrote in message
    news:pIj7f.298576$tl2.109713@pd7tw3no...
    > Hi All,
    >
    > Does anybody know how I can automatically name the sheets of a workbook
    > based on the contents of a cell. For example, if I have the word January
    > in
    > Cell A:1, I would like the Sheet name to be January. If I change January
    > to May, I would like the sheet to automatically update and rename itself
    > to May.
    >
    > Any ideas?
    >
    > Thanks,
    >
    > Steve
    >




  3. #3
    Bob Phillips
    Guest

    Re: Automatically Update Sheet Names

    If you want it for all sheets in a book, try
    Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
    Const WS_RANGE As String = "A1"

    On Error GoTo ws_exit:
    Application.EnableEvents = False
    If Not Intersect(Target, Sh.Range(WS_RANGE)) Is Nothing Then
    With Target
    If .Value <> "" Then
    Sh.Name = .Value
    End If
    End With
    End If

    ws_exit:
    Application.EnableEvents = True
    End Sub

    'To input this code, right click on the Excel icon on the worksheet
    '(or next to the File menu if you maximise your workbooks),
    'select View Code from the menu, and paste the code

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "Steve" <[email protected]> wrote in message
    news:pIj7f.298576$tl2.109713@pd7tw3no...
    > Hi All,
    >
    > Does anybody know how I can automatically name the sheets of a workbook
    > based on the contents of a cell. For example, if I have the word January

    in
    > Cell A:1, I would like the Sheet name to be January. If I change January
    > to May, I would like the sheet to automatically update and rename itself

    to
    > May.
    >
    > Any ideas?
    >
    > Thanks,
    >
    > Steve
    >
    >




  4. #4
    Steven Taylor
    Guest

    Re: Automatically Update Sheet Names

    Thanks guy's,

    The code works just great!

    Steve




    *** Sent via Developersdex http://www.developersdex.com ***

+ 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