+ Reply to Thread
Results 1 to 6 of 6

Add cell value to existing tab name - VBA

Hybrid View

DRHallgren Add cell value to existing... 08-14-2014, 05:03 PM
TMS Re: Add cell value to... 08-14-2014, 05:46 PM
TMS Re: Add cell value to... 08-14-2014, 05:48 PM
DRHallgren Re: Add cell value to... 08-15-2014, 08:34 AM
DRHallgren Re: Add cell value to... 08-15-2014, 08:36 AM
TMS Re: Add cell value to... 08-15-2014, 08:49 AM
  1. #1
    Registered User
    Join Date
    07-28-2014
    Location
    Charlotte, NC
    MS-Off Ver
    2010
    Posts
    3

    Add cell value to existing tab name - VBA

    I've searched the existing threads, but haven't been able to find a solution that will help me. I apologize if I've missed it, and please point me in the right direction!Invoice Example.xls

    My situation is as follows: I have multiple workbooks that each contain three worksheets, the worksheets from one or more of these workbooks needs to be added to another workbook.

    Since the worksheet names in all workbooks are the same, I need to add the data from a cell (account number) in the file to the existing worksheet names. Using the attached file as an example, the value of cell A8 on the DMC-UPS-Summary worksheet needs to be added to each worksheet name in this file.

    Thanks for any help that you can provide!

    Diane

  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
    48,577

    Re: Add cell value to existing tab name - VBA

    Hi Diane, welcome to the forum.

    Option Explicit
    
    Sub sAmendSheetNames()
    
    Dim sSuffix As String
    sSuffix = Sheets("DMC-UPS-Summary").Range("A8")
    
    Dim sh As Worksheet
    For Each sh In Worksheets
        sh.Name = sh.Name & " " & sSuffix
    Next 'sh
    
    End Sub

    Regards, TMS
    Last edited by TMS; 08-14-2014 at 06:25 PM.
    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 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
    48,577

    Re: Add cell value to existing tab name - VBA

    Sub sListSheetNames()
    
    Dim sh As Worksheet
    For Each sh In Worksheets
        Debug.Print sh.Name
    Next 'sh
    
    End Sub
    
    'Output:
    'DMC-UPS-GL-Sum 000002RXXX
    'DMC-UPS-Summary 000002RXXX
    'DMC-UPS-Detail 000002RXXX

    Regards, TMS

  4. #4
    Registered User
    Join Date
    07-28-2014
    Location
    Charlotte, NC
    MS-Off Ver
    2010
    Posts
    3

    Re: Add cell value to existing tab name - VBA

    Thank you for your speedy and wonderful reply TMS! This works perfectly! I hope that you have a wonderful weekend.

    Diane

  5. #5
    Registered User
    Join Date
    07-28-2014
    Location
    Charlotte, NC
    MS-Off Ver
    2010
    Posts
    3

    Re: Add cell value to existing tab name - VBA

    Thank you for your speedy and wonderful reply TMS! This works perfectly! I hope that you have a wonderful weekend.

    Diane

  6. #6
    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
    48,577

    Re: Add cell value to existing tab name - VBA

    You're welcome.



    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

+ 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. Replies: 11
    Last Post: 11-04-2013, 04:32 PM
  2. [SOLVED] Check for existing cell values in another cell and remove them + 1 character.
    By ali.whitaker in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-21-2013, 06:17 AM
  3. Replies: 3
    Last Post: 10-14-2013, 03:06 PM
  4. [SOLVED] Correct way to apply an existing VBA code to an existing sheet
    By JO505 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-05-2013, 05:42 PM
  5. Replies: 1
    Last Post: 08-15-2009, 05:52 AM

Tags for this Thread

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