+ Reply to Thread
Results 1 to 8 of 8

Trying to update a sheet name based on a cell value. It works, sort of,

  1. #1
    Registered User
    Join Date
    11-03-2022
    Location
    Shreveport, LA USA
    MS-Off Ver
    Home and Business 2016
    Posts
    7

    Trying to update a sheet name based on a cell value. It works, sort of,

    Trying to update a sheet name based on a cell value. It works, sort of, but I have to go to that sheet and use the up or down arrows or some keystroke to get it to complete the function. Is there a way to automate this process so that I don't have to do anything except update the cell? My code is below. Please HELP!


    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Set Target = Range("E1")
    If Target = "" Then Exit Sub
    Application.ActiveSheet.Name = VBA.Left(Target, 31)
    Exit Sub
    End Sub


    Darren

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,466

    Re: Trying to update a sheet name based on a cell value. It works, sort of,

    Try:

    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Contributor
    Join Date
    10-02-2012
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    252

    Re: Trying to update a sheet name based on a cell value. It works, sort of,

    Well that code is designed to specifically function when you click on the cell "E1".

    The simplist way is to change the event to "Worksheet_Activate" and use this;

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    11-03-2022
    Location
    Shreveport, LA USA
    MS-Off Ver
    Home and Business 2016
    Posts
    7

    Re: Trying to update a sheet name based on a cell value. It works, sort of,

    That works much better, but I still have to click on the sheet then it changes. Sorry to be so picky and forgive me I am very new to VBA.

  5. #5
    Forum Contributor
    Join Date
    10-02-2012
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    252

    Re: Trying to update a sheet name based on a cell value. It works, sort of,

    I would go with TMS over mine, I believe his should work without clicking anything.

  6. #6
    Registered User
    Join Date
    11-03-2022
    Location
    Shreveport, LA USA
    MS-Off Ver
    Home and Business 2016
    Posts
    7

    Re: Trying to update a sheet name based on a cell value. It works, sort of,

    Unfortunately, TMS's code did not work. This is the code PrizeGotti sent and it functions well with the exception of having to click on the sheet to make it change

    Private Sub Worksheet_Activate()
    Set Target = Range("E1")
    If Range("E1") = "" Then Exit Sub
    Application.ActiveSheet.Name = VBA.Left(Target, 31)
    End Sub

  7. #7
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    1,985

    Re: Trying to update a sheet name based on a cell value. It works, sort of,

    Are you using a formula to calculate the value in E1? If so, maybe use the sheet_calculate event

    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    11-03-2022
    Location
    Shreveport, LA USA
    MS-Off Ver
    Home and Business 2016
    Posts
    7

    Re: Trying to update a sheet name based on a cell value. It works, sort of,

    OMG ! Genius. Thank you SO much ByteMarks

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. VBA/Macro to Automatically Update, Copy, & Sort information from Sheet 1 to Sheet 2
    By E9demello in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-10-2017, 09:37 AM
  2. Update a sheet based on cell values
    By amitabha0107 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-25-2016, 07:57 AM
  3. Automatically Update Cell Entries Based on other Sheet
    By civram1982 in forum Excel General
    Replies: 3
    Last Post: 01-07-2016, 06:17 AM
  4. Replies: 0
    Last Post: 07-10-2013, 10:54 AM
  5. Update cell based on another sheet
    By MileHiMark in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-29-2013, 02:01 AM
  6. Macro to automatically update sheet name based on cell value
    By seanfoxen in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-12-2012, 05:17 PM
  7. Update row based on cell input in another sheet
    By Kazumi in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-13-2011, 03:24 AM

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