I'm not sure why, but I keep getting an Else without If error. Any ideas?
On Error Resume Next
Exists = Sheets("MCC" & x)
If Err.Number = 0 Then 'sheet exists so do nothing
Do
If y = x Then
y = y + 1
End If
While (Sheets = Sheets(x))
Sheets("TempName").Select
Sheets("TempName").Name = "MCC " & x
Else 'sheet doesn't exist so assign it
'Renaming the sheet
Sheets("TempName").Select
Sheets("TempName").Name = "MCC " & x
End If
On Error Resume Next
Exists = Sheets("MCC" & x)
If Err.Number = 0 Then 'sheet exists so do nothing
Do
If y = x Then
y = y + 1
End If
While (Sheets = Sheets(x))
Sheets("TempName").Select
Sheets("TempName").Name = "MCC " & x
Else 'sheet doesn't exist so assign it
'Renaming the sheet
Sheets("TempName").Select
Sheets("TempName").Name = "MCC " & x
End If