View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] bevanward@gmail.com is offline
external usenet poster
 
Posts: 1
Default Delete all named ranges in a workbook

Hi All

I've obviously missing something here and would appreciate any help.
I've seen a few similar threads but they haven't helped ....

I have an excel 97 workbook with a series of named ranges and would
like to delete them all. I'm suring the code ...

Sub a()


Worksheets(1).Select

For i = 1 To Worksheets.Count

Worksheets(i).Select

For n = 1 To ActiveSheet.Names.Count
strNAME = ActiveSheet.Names(n).Name
ActiveSheet.Names(n).Delete
Next n

n = 1
Worksheets(i).Select

Next i



End Sub

.... however when I run this code I keep getting error 9 from the
subscript being out of range.

I'm sure I'm making a simple mistake...

Thanks in advance

Cheers
Bevan