VBA – Rename sheets with cell values – Error 1004
I’m trying to rename several sheets based on cell values but can’t figure out how to check for duplicate values and add a number to those names.
This is the code I’m starting with, which gets the job done so long as no other worksheets have the same values in both F4 and E4.
Sub Rename_Sheet()
ActiveSheet.name = Range(“F4″) & ” to ” & Range(“E4”)
End Sub
I’m trying to rename several sheets based on cell values but can’t figure out how to check for duplicate values and add a number to those names. This is the code I’m starting with, which gets the job done so long as no other worksheets have the same values in both F4 and E4. Sub Rename_Sheet()ActiveSheet.name = Range(“F4″) & ” to ” & Range(“E4”)End Sub Read More