View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Macro to delete names except Print_Area

Typo alert patrol:

If InStr(1, nName.Name, "Print_Area", vbTextCompare) = 0 Then

(dot instead of a comma in nName.Name)

Tom Ogilvy wrote:

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



--

Dave Peterson