+ Reply to Thread
Results 1 to 4 of 4

Rename tabs based on values entered in specific cells

  1. #1
    Registered User
    Join Date
    04-28-2013
    Location
    Bangalore
    MS-Off Ver
    Excel 2010
    Posts
    81

    Rename tabs based on values entered in specific cells

    Following is the code I have used to rename 15 tabs in a excel file based on the inputs in cells A1 to A15 in my First tab called "Master" which remains intact.

    The problem I face here is IF cells A1 to A11 are filled and the cells A12 to A15 are blank,it gives an error. Instead I would want the 4 tabs to be hidden since there are no inouts.




    Sub Final()
    Dim ws As Worksheet
    Dim lngCounter As Long

    If Worksheets.Count < 16 Then
    MsgBox "Not enough sheets in Workbook"
    For lngCounter = Worksheets.Count To 16
    Sheets.Add after:=Worksheets(Worksheets.Count)
    Next lngCounter
    End If

    For lngCounter = 1 To 15
    If lngCounter = "0" Then ActiveWindow.DisplayWorkbookTabs = False

    Worksheets(lngCounter + 1).Name = Worksheets(1).Cells(lngCounter, "A").Value
    Next lngCounter

    End Sub

  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
    44,420

    Re: Rename tabs based on values entered in specific cells

    Maybe:

    Please Login or Register  to view this content.

    Regards, TMS
    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 Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,583

    Re: Rename tabs based on values entered in specific cells

    Try This

    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    04-28-2013
    Location
    Bangalore
    MS-Off Ver
    Excel 2010
    Posts
    81

    Re: Rename tabs based on values entered in specific cells

    Thanks ! this is exactly what I was looking for.

+ 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