Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default clearing ranges

How do I clear or reset all range names once I am finished a procedure?

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200512/1
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default clearing ranges

The Workbook.Names collection holds all the named ranges used in your workbook.
This clears the cells (contents and formats) and deletes the named range
from the list of names:
Dim N as Name
For Each N in ThisWorkbook.Names
With N.RefersToRange
.ClearContents
.ClearFormats
.Delete
End With
Next N
--
- K Dales


"newnhamm via OfficeKB.com" wrote:

How do I clear or reset all range names once I am finished a procedure?

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200512/1

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default clearing ranges

Thanx, I'll try it now!

Mike

K Dales wrote:
The Workbook.Names collection holds all the named ranges used in your workbook.
This clears the cells (contents and formats) and deletes the named range
from the list of names:
Dim N as Name
For Each N in ThisWorkbook.Names
With N.RefersToRange
.ClearContents
.ClearFormats
.Delete
End With
Next N
How do I clear or reset all range names once I am finished a procedure?


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200512/1
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default clearing ranges

I have tried what you suggested but I don't want to clear the cells, just
delete the names so that I can set the ranges again. Would I omit :

.ClearContents
.ClearFormats

??

Mike

newnhamm wrote:
Thanx, I'll try it now!

Mike

The Workbook.Names collection holds all the named ranges used in your workbook.
This clears the cells (contents and formats) and deletes the named range

[quoted text clipped - 8 lines]
Next N
How do I clear or reset all range names once I am finished a procedure?


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200512/1
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default clearing ranges

That left names with bad references in the workbook for me. Perhaps K Dales
meant this:

sub abc()
Dim N As Name
For Each N In ThisWorkbook.Names
With N.RefersToRange
.ClearContents
.ClearFormats
End With
Next N
End Sub

this would assume that you don't have names that contain formulas rather
than refer to ranges. It also assumes you want to retain the names in the
workbook.

--
Regards,
Tom Ogilvy




"K Dales" wrote in message
...
The Workbook.Names collection holds all the named ranges used in your

workbook.
This clears the cells (contents and formats) and deletes the named range
from the list of names:
Dim N as Name
For Each N in ThisWorkbook.Names
With N.RefersToRange
.ClearContents
.ClearFormats
.Delete
End With
Next N
--
- K Dales


"newnhamm via OfficeKB.com" wrote:

How do I clear or reset all range names once I am finished a procedure?

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200512/1





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default clearing ranges

sub abc()
Dim N As Name
For Each N In ThisWorkbook.Names
n.Delete
Next
End Sub

--
Regards,
Tom Ogilvy

"newnhamm via OfficeKB.com" <u16692@uwe wrote in message
news:592aff0a93034@uwe...
I have tried what you suggested but I don't want to clear the cells, just
delete the names so that I can set the ranges again. Would I omit :

.ClearContents
.ClearFormats

??

Mike

newnhamm wrote:
Thanx, I'll try it now!

Mike

The Workbook.Names collection holds all the named ranges used in your

workbook.
This clears the cells (contents and formats) and deletes the named range

[quoted text clipped - 8 lines]
Next N
How do I clear or reset all range names once I am finished a

procedure?

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200512/1



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,163
Default clearing ranges

Thanks for fixing my mistake, Tom! It was carelessness on my part; the
..Delete should not have been inside the With N.RefersToRange, since I meant
to delete the Name object and not the range it referred to.
--
- K Dales


"Tom Ogilvy" wrote:

sub abc()
Dim N As Name
For Each N In ThisWorkbook.Names
n.Delete
Next
End Sub

--
Regards,
Tom Ogilvy

"newnhamm via OfficeKB.com" <u16692@uwe wrote in message
news:592aff0a93034@uwe...
I have tried what you suggested but I don't want to clear the cells, just
delete the names so that I can set the ranges again. Would I omit :

.ClearContents
.ClearFormats

??

Mike

newnhamm wrote:
Thanx, I'll try it now!

Mike

The Workbook.Names collection holds all the named ranges used in your

workbook.
This clears the cells (contents and formats) and deletes the named range
[quoted text clipped - 8 lines]
Next N
How do I clear or reset all range names once I am finished a

procedure?

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200512/1




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Clearing cells without clearing formulas marsjune68 Excel Discussion (Misc queries) 2 April 10th 09 07:39 PM
how copy formula that contains ranges so ranges do not overlap Patty Excel Worksheet Functions 1 November 20th 08 04:15 PM
Clearing Ranges from Multiple workbooks. Steve O Excel Programming 3 October 11th 05 08:11 PM
named ranges - changing ranges with month selected gr8guy Excel Programming 2 May 28th 04 04:50 AM
Clearing Data ranges from Multiple Worksheets Sam Fowler[_2_] Excel Programming 3 April 12th 04 02:04 AM


All times are GMT +1. The time now is 05:34 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"