View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Macro to delete names except Print_Area

Sub DeleteNames()
'
' Gets rid of all named ranges
'
For Each nName In Names
if instr(1,nName,Name,"Print_Area",vbtextcompare) = 0 then
nName.Delete
end if
Next
'
End Sub

--
Regards,
Tom Ogilvy



" wrote:

I have a macro that deletes all of the named ranges in my workbook. The
problem is that it also deletes the "Print_Area" range, which results
in resetting my print area.

Is there a way to modify this so that it will keep my old print area?

Sub DeleteNames()
'
' Gets rid of all named ranges
'
For Each nName In Names
nName.Delete
Next
'
End Sub