I don't know why it errors.
Instead of changing the code name, couldn't you just loop through the sheets and delete them by name.
![]()
Dim ws As Worksheet Application.DisplayAlerts = False For Each ws In Worksheets If ws.Name Like "Cost*-*-*" Then ws.Delete Next ws Application.DisplayAlerts = True
Bookmarks