Results 1 to 6 of 6

Macro to rename sheet based on date in a cell with multiple occurrences.

Threaded View

  1. #1
    Registered User
    Join Date
    10-19-2010
    Location
    new mexico, US
    MS-Off Ver
    Excel 2007
    Posts
    14

    Macro to rename sheet based on date in a cell with multiple occurrences.

    Guys,

    I am getting whooped here.

    I have a spreadsheet that has 25 tabs. This worksheet updates based on an external data pull. I need to rename all the tabs in this sheet based on a date that is in cell C7 on each sheet.

    I have that part down with this code.

    For i = 1 To Sheets.Count
        If Worksheets(i).Range("p1").Value <> "" Then
            Sheets(i).Name = Worksheets(i).Range("p1").Value
        Else:
            Sheets(i).Name = "Default (" & i & ")"
        End If
      Next
    End Sub
    Now the problem that I have is that I may have the same date repeat 5 or 6 times in this data and need it to add a (2), (3), etc... to each extra one after the first. It is acceptable if it puts a (1) on the first one also.

    Anyone have any ideas?
    Last edited by timlocke; 04-09-2011 at 12:44 PM.

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