PC Review


Reply
Thread Tools Rate Thread

Can't delete named ranges?

 
 
=?Utf-8?B?TWF1cnkgTWFya293aXR6?=
Guest
Posts: n/a
 
      5th Mar 2007
I have found that you can only have one named range referring to a particular
range. You can add more, but they are not visible or editable in the sheets.

So I am attempting to delete all the names on a worksheet prior to
rebuilding them. I used:

Dim theSheet As Worksheet
Set theSheet = Worksheets("Input")
For Each namedRange In theSheet.Names
theSheet.Names(namedRange.Name).Delete
Next namedRange

When I use this, the code is skipped over as theSheet.Names is empty.
However when I simply click around on the sheet I can see that there are
names there.

Does anyone know why this list appears empty even though there are ranges on
the sheet?

Maury
 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      5th Mar 2007
First, I've used multiple names that point at the same range and had no trouble
seeing them in the Insert|Name|define dialog.

Second, are you sure that the names are worksheet level names--not workbook
level names?

Third, since you're working with names, get Jan Karel Pieterse's (with Charles
Williams and Matthew Henson) Name Manager:

You can find it at:
NameManager.Zip from http://www.oaltd.co.uk/mvp



Maury Markowitz wrote:
>
> I have found that you can only have one named range referring to a particular
> range. You can add more, but they are not visible or editable in the sheets.
>
> So I am attempting to delete all the names on a worksheet prior to
> rebuilding them. I used:
>
> Dim theSheet As Worksheet
> Set theSheet = Worksheets("Input")
> For Each namedRange In theSheet.Names
> theSheet.Names(namedRange.Name).Delete
> Next namedRange
>
> When I use this, the code is skipped over as theSheet.Names is empty.
> However when I simply click around on the sheet I can see that there are
> names there.
>
> Does anyone know why this list appears empty even though there are ranges on
> the sheet?
>
> Maury


--

Dave Peterson
 
Reply With Quote
 
Don Guillett
Guest
Posts: n/a
 
      5th Mar 2007

try a simpler approach

for each n in sheets("Input").names
n.delete
next n

--
Don Guillett
SalesAid Software
(E-Mail Removed)
"Dave Peterson" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> First, I've used multiple names that point at the same range and had no
> trouble
> seeing them in the Insert|Name|define dialog.
>
> Second, are you sure that the names are worksheet level names--not
> workbook
> level names?
>
> Third, since you're working with names, get Jan Karel Pieterse's (with
> Charles
> Williams and Matthew Henson) Name Manager:
>
> You can find it at:
> NameManager.Zip from http://www.oaltd.co.uk/mvp
>
>
>
> Maury Markowitz wrote:
>>
>> I have found that you can only have one named range referring to a
>> particular
>> range. You can add more, but they are not visible or editable in the
>> sheets.
>>
>> So I am attempting to delete all the names on a worksheet prior to
>> rebuilding them. I used:
>>
>> Dim theSheet As Worksheet
>> Set theSheet = Worksheets("Input")
>> For Each namedRange In theSheet.Names
>> theSheet.Names(namedRange.Name).Delete
>> Next namedRange
>>
>> When I use this, the code is skipped over as theSheet.Names is empty.
>> However when I simply click around on the sheet I can see that there are
>> names there.
>>
>> Does anyone know why this list appears empty even though there are ranges
>> on
>> the sheet?
>>
>> Maury

>
> --
>
> Dave Peterson



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Delete named ranges in VBA - by scope? Revolvr Microsoft Excel Programming 2 22nd Jul 2011 11:49 PM
Delete unnecessary Named Ranges berniean Microsoft Excel Misc 1 27th Aug 2009 07:24 PM
Named ranges scope / workbook/worksheet level named ranges- changeswith variable use... christian_spaceman Microsoft Excel Programming 3 24th Dec 2007 01:15 PM
Delete all Named Ranges except PrintArea DoctorV Microsoft Excel Discussion 2 8th Oct 2004 08:53 PM
Delete Contents of Named Ranges(s) Anthony Viscomi Microsoft Excel Discussion 10 22nd Mar 2004 09:22 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:27 AM.