Hi- I have a workbook where Name Manager won't even open because there's so many names. I have a macro to delete the names and save in batches- but I also want it to retain any "Print_Areas." Here is my current code that runs but it still deletes all Print Areas. Suggestions?
Sub DeleteDeadNames2()
Dim nName As Name
Dim lCount As Long
With ActiveWorkbook
For lCount = .Names.Count To 1 Step -1
If lCount Mod 1000 = 0 Then
Debug.Print lCount
.Save
DoEvents
End If
If Right(.Names(lCount), 11) <> "!Print_Area" And .Names(lCount) <> "Print_Area" Then
.Names(lCount).delete
End If
Next lCount
End With
End Sub
Sub DeleteDeadNames2()
Dim nName As Name
Dim lCount As Long
With ActiveWorkbook
For lCount = .Names.Count To 1 Step -1
If lCount Mod 1000 = 0 Then
Debug.Print lCount
.Save
DoEvents
End If
If Right(.Names(lCount), 11) <> "!Print_Area" And .Names(lCount) <> "Print_Area" Then
.Names(lCount).delete
End If
Next lCount
End With
End Sub