Hi- My Company's software macro creates hidden names in our workbooks making them clunky and unnecessarily large, so I am trying to get a macro to first unhide all names in the name manger, then delete all, except the print range. Except I am gettin a 1004 name syntax error on the n.Delete portion of the second sub below - thinking it may be because some of the names generated include items with special characters (i.e. _Order 1 and random symbols to start the names). Please let me know if you have a fix or can tell me what I'm doing wrong and thanks!
Sub ShowAllNames()Dim n As Name For Each n In ActiveWorkbook.Names n.Visible = True Next n End Sub Sub DeleteAllRangesExceptPrintArea() Dim n As Name For Each n In ActiveWorkbook.Names If Right(n.Name, 11) <> "!Print_Area" And n.Name <> "Print_Area" Then [B]n.Delete[/B] Next n End Sub