+ Reply to Thread
Results 1 to 5 of 5

Changing Sheet Names based on a Cell Reference

  1. #1
    Registered User
    Join Date
    12-01-2011
    Location
    NY, NY
    MS-Off Ver
    Excel 2007
    Posts
    11

    Changing Sheet Names based on a Cell Reference

    Hi all,

    I'm trying to connect two excel files by using VBA. First, I'm copied a sheet named "Template" from File 1 to File 2 and inserted a new sheet and copied the information again from the sheet named "Template" to this new sheet using a recorded macro (I'm very new to VBA/macros so I'm sure this could be simplified but I'm happy just to have gotten it to work). However, now I want to rename this new sheet based on the contents in cell B2.

    Each new sheet will have different values in cell B2 (2012-1, 2012-2...etc.) and I want to write some code that will easily change the sheet names for me without renaming each tab. There will be potentially 100+ tabs so I would be very time consuming to do so. Does anyone have any thoughts?

    Thanks,

    Tom
    Last edited by tjloggia; 01-04-2012 at 04:38 PM.

  2. #2
    Forum Guru tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Changing Sheet Names based on a Cell Reference

    tjloggia,

    Give this a try:

    Please Login or Register  to view this content.
    Hope that helps,
    ~tigeravatar

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  3. #3
    Registered User
    Join Date
    12-01-2011
    Location
    NY, NY
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Changing Sheet Names based on a Cell Reference

    Thanks for the help. It did work. But there are a number of static tabs in the file that I don't want the sheet name to reference cell B2; is it possible to only run the procedure for the current sheet and not all the sheets?

    Thanks!

  4. #4
    Forum Guru tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Changing Sheet Names based on a Cell Reference

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    12-01-2011
    Location
    NY, NY
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Changing Sheet Names based on a Cell Reference

    Success! Thanks so much!

+ 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