Search This Blog

Tuesday 11 May 2010

Excel - Remove all named ranges in a sheet

  1. Copy the code. 
  2.  
    Option Explicit 
     
    Sub RemNamedRanges() 
         
        Dim nm              As Name 
         
        On Error Resume Next 
        For Each nm In ActiveWorkbook.Names 
            nm.Delete 
        Next 
        On Error Goto 0 
         
    End Sub 
  3. Open any workbook.
  4. Hit Alt+F11 to open the Visual Basic Editor (VBE).
  5. On the left, choose a file.
  6. From the menu, choose Insert-Module.
  7. Paste the code into the code window at right.
  8. Hit the save diskette and close the VBE.
  9. Run the macro by going to Tools-Macro-Macros and double-click RemNamedRanges.