|
|
|
|
|
|
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:
|
- Copy the code.
- Open any workbook.
- Hit Alt+F11 to open the Visual Basic Editor (VBE).
- On the left, choose a file.
- From the menu, choose Insert-Module.
- Paste the code into the code window at right.
- Hit the save diskette and close the VBE.
|
Test the code:
|
- 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.
|
|