+ Reply to Thread
Results 1 to 3 of 3

Rename all worksheets in workbook

  1. #1
    Registered User
    Join Date
    04-12-2005
    Posts
    2

    Rename all worksheets in workbook

    I've found some code similar to, but not quite what I need. I have workbooks that contain various numbers of worksheets. I have one macro that replaces the contents of a cell using the name of the worksheet. Here's what I am looking for: I need to be able to run a macro that will rename all the worksheets in the workbook with the contents from a particular cell. I've tried a few different things but I'm new to this and of course they didn't work.
    Thanks for your help, Roger

  2. #2
    Registered User
    Join Date
    04-07-2005
    Posts
    6
    Assuming that the cell containing the name to be used for each sheet is in cell A1:

    Sub SetSheetNames()
    Dim Number, Counter
    Number = ActiveWorkbook.Sheets.Count
    For Counter = 1 To Number
    Worksheets(Counter).Activate
    Worksheets(Counter).Name = ActiveSheet.Range("A1").Value
    Next Counter
    End Sub

    That should do the trick.

  3. #3
    Registered User
    Join Date
    04-12-2005
    Posts
    2
    Awesome, thanks very 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