Hi- I need to delete all name ranges in Name Manager except for the Print_Areas but i need to do it in small batched due to the sheet not opening up. THis code runs but it still deletes all names. What am I missing?
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