Excel

Remove all Named Ranges

Ease of Use

Easy

Version tested with

2000, 2002 

Submitted by:

Jacob Hilderbrand

Description:

Removes all named ranges in a workbook. 

Discussion:

Sometimes, you want to send a workbook to someone else and you no longer need or want the named ranges to follow it. Use this macro to clear them all. More than likely, you'll combine this code with other cleanup code for emailing workbooks or place it in your personal macro file. 

Code:

instructions for use

			

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

How to use:

  1. Copy the code.
  2. Open any workbook.
  3. Hit Alt+F11 to open the Visual Basic Editor (VBE).
  4. On the left, choose a file.
  5. From the menu, choose Insert-Module.
  6. Paste the code into the code window at right.
  7. Hit the save diskette and close the VBE.
 

Test the code:

  1. Run the macro by going to Tools-Macro-Macros and double-click RemNamedRanges.
 

Sample File:

No Attachment 

Approved by Jacob Hilderbrand


This entry has been viewed 184 times.

Please read our Legal Information and Privacy Policy
Copyright @2004 - 2020 VBA Express