+ Reply to Thread
Results 1 to 7 of 7

Rename Sheet using VBA Project name as a reference

  1. #1
    Forum Contributor
    Join Date
    04-16-2014
    Location
    Australia
    MS-Off Ver
    Excel 365
    Posts
    125

    Rename Sheet using VBA Project name as a reference

    I need to rename a worksheet using the VBA Project name as the reference.

    The following renames the VBA project name of the sheet, which I don't want.

    ThisWorkbook.VBProject.VBComponents("Sheet4").Name = "Data"

    I want the VBA project name to remain as "Sheet4", but the sheet name to change to "Data"

    Would someone please offer some advice.

    Regards

    Yoepy

  2. #2
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Rename Sheet using VBA Project name as a reference

    If you use
    Please Login or Register  to view this content.
    Then Excel will automatically change the sheet name in the Project pane of the editor. I am not sure you can make that change in reverse fashion by changing the sheet tab name in the project pane without changing it in the Excel window.
    Any code provided by me should be tested on a copy or a mock up of your original data before applying it to the original. Some events in VBA cannot be reversed with the undo facility in Excel. If your original post is satisfied, please mark the thread as "Solved". To upload a file, see the banner at top of this page.
    Just when I think I am smart, I learn something new!

  3. #3
    Forum Contributor
    Join Date
    04-16-2014
    Location
    Australia
    MS-Off Ver
    Excel 365
    Posts
    125

    Re: Rename Sheet using VBA Project name as a reference

    Sorry JLGWhiz, that renames a sheet called "Sheet4".
    There is no sheet called "Sheet4".
    I'm wanting to rename the sheet which according to the Microsoft Excel Objects in the VBA Project window is called Sheet4(somethingelse) to Sheet4(Data), using the Excel object as the reference.

    I don't want the Properties name to change - just the sheet name shown on the worksheet tab.

    Regards

    Yoepy

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,560

    Re: Rename Sheet using VBA Project name as a reference

    Please Login or Register  to view this content.
    Or simply
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    04-16-2014
    Location
    Australia
    MS-Off Ver
    Excel 365
    Posts
    125

    Re: Rename Sheet using VBA Project name as a reference

    Thanks jindon. Exactly what I needed.

  6. #6
    Forum Expert JLGWhiz's Avatar
    Join Date
    02-20-2011
    Location
    Florida, USA
    MS-Off Ver
    Windows 10, Excel 2013
    Posts
    2,070

    Re: Rename Sheet using VBA Project name as a reference

    Just for clarity:
    Please Login or Register  to view this content.
    is the sheet tab name
    Please Login or Register  to view this content.
    is the Excel code name of a sheet and could have a different tab name
    Please Login or Register  to view this content.
    is the fourth sheet from left to right and could have both code name and tab name different.

  7. #7
    Forum Contributor
    Join Date
    04-16-2014
    Location
    Australia
    MS-Off Ver
    Excel 365
    Posts
    125

    Re: Rename Sheet using VBA Project name as a reference

    Thank you JLGWhiz, that's a simple but important explanation.

+ 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. [SOLVED] Macro to find and rename cell reference?
    By mcphailmonator in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-09-2015, 12:35 PM
  2. [SOLVED] Copy a sheet, rename it by value in range then export product to new workbook and rename
    By MagicMan in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-31-2015, 07:24 PM
  3. Replies: 0
    Last Post: 06-28-2014, 02:26 PM
  4. Rename worksheet to a cell reference
    By talahuyen in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-24-2012, 10:12 AM
  5. Replies: 11
    Last Post: 06-15-2012, 07:06 AM
  6. [SOLVED] Rename a worksheet with via a cell reference
    By chyanbiggs in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-15-2012, 09:35 PM
  7. rename sheets using reference cells
    By Joshua@work in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-28-2010, 06:34 PM

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