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
Bookmarks