I am trying to rename tabs in my large excel by using a cell value in each worksheet. The issue is, I would like to rename multiple tabs with the same name, which is not allowed. I am ok with adding a 1, then a 2 etc but am not sure how to do that.
For example if the cell value in 3 sheets is Ohio, then the tabs would be Ohio1, Ohio2, Ohio3.
The name of each sheet should be the value in A1, but I want to account for duplicate names.
The vba code to do it without accounting for the same name is:
Sub Worksheet_SelectionChange()
Dim ws As Worksheet
For Each ws In Sheets
ws.Activate
ActiveSheet.Name = Range("a1").Value
Next ws
End Sub