Hi VBA Experts,

I have a simple VBA code to rename worksheets. I listed it below. I created a list in the Range("C8:C272"). I do not have any duplicate names in the list. However, I am getting this message.

"Run-time error '1004':

That name already taken. Try a different one."


I used conditional formatting to check for duplicates and it doesn't find any. Any idea what could be going wrong?

VBA CODE:

Sub RenameSheets()


Dim c As Range
Dim J As Integer


J = 9
For Each c In Range("C8:C272")


J = J + 1

If Sheets(J).Name = "List" Then J = J + 1
Sheets(J).Name = c.Text

Next c


End Sub