Hi,
I am trying to rename 2 tabs each on 60 files, this is the code I have below.
Sub DirLoop2()
Application.ScreenUpdating = False
Application.DisplayAlerts = 0
Dim MyFile As String, Sep As String
Sep = Application.PathSeparator
If Sep = "\" Then
MyFile = Dir("C:\Sales Forecasting test bed\Customers" & Sep & "*.xls")
Do While MyFile <> ""
A = "C:\Sales Forecasting test bed\Customers\" & MyFile
Workbooks.Open (A)
Sheets("EXCEPTION 3 MONTH").Select
Sheets("EXCEPTION 3 MONTH").Name = "EXCEPTIONAL 3 MONTH"
Sheets("EXCEPTION 5 MONTH").Select
Sheets("EXCEPTION 5 MONTH").Name = "EXCEPTIONAL 5 MONTH"
'Finished
ActiveWorkbook.Save
ActiveWindow.Close
'End of main macro stuff
MyFile = Dir()
Loop
Application.ScreenUpdating = True
End Sub
The problem is, some of the files have the tabs named correctly or have a name other than the one specified in my macro.
Eg: 70% of the files have the tabs named "EXCEPTION 3 MONTH", 20% have "EXCPTION 3 MONTH" and 10% have "EXCEPTIONAL 3 MONTH" as the tab names.
Is there a way I could I force all other names of the tabs to be changed to the new one ?
Thanks,
Bookmarks