PC Review


Reply
Thread Tools Rate Thread

Checking named range

 
 
learner
Guest
Posts: n/a
 
      10th Nov 2006
Hi,

I have an excel sheet which has a number of named cells (say NM1, NM2,
NM3, etc). I do not use all the names everytime. Is there a way to
check from a macro if a named range is being used in the active sheet
or not ?

Any help would be appreciated !

 
Reply With Quote
 
 
 
 
=?Utf-8?B?R2FyeScncyBTdHVkZW50?=
Guest
Posts: n/a
 
      10th Nov 2006
If the named range contained only empty cells, would you consider it used?
--
Gary's Student


"learner" wrote:

> Hi,
>
> I have an excel sheet which has a number of named cells (say NM1, NM2,
> NM3, etc). I do not use all the names everytime. Is there a way to
> check from a macro if a named range is being used in the active sheet
> or not ?
>
> Any help would be appreciated !
>
>

 
Reply With Quote
 
Earl Kiosterud
Guest
Posts: n/a
 
      10th Nov 2006
Learner,

Paste this from here into a module. Watch for email-induced line feeds. If
there are more than 65K names, it will auger in.

Sub NamedRangeList()
Dim NamedRange As Name
Dim Roww As integer

Range("A:B").ClearContents ' blow off existing stuff
Range("A1") = "Name" ' Heading
Range("B1") = "Refers to"
Roww = 2
For Each NamedRange In Names
Cells(Roww, 1) = NamedRange.Name
Cells(Roww, 2) = "'" & NamedRange.RefersTo
Roww = Roww + 1
Next NamedRange
End Sub
--
Earl Kiosterud
www.smokeylake.com
-----------------------------------------------------------------------
"learner" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
>
> I have an excel sheet which has a number of named cells (say NM1, NM2,
> NM3, etc). I do not use all the names everytime. Is there a way to
> check from a macro if a named range is being used in the active sheet
> or not ?
>
> Any help would be appreciated !
>



 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      10th Nov 2006
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

There's an option to show if the name is used in cell formulas or other names.
But this won't check any code that refers to that range--or other workbooks that
refer to that name.

learner wrote:
>
> Hi,
>
> I have an excel sheet which has a number of named cells (say NM1, NM2,
> NM3, etc). I do not use all the names everytime. Is there a way to
> check from a macro if a named range is being used in the active sheet
> or not ?
>
> Any help would be appreciated !


--

Dave Peterson
 
Reply With Quote
 
Earl Kiosterud
Guest
Posts: n/a
 
      11th Nov 2006
Learner,

Oops. I forgot you wanted to know which cells have stuff in them. Here's
an update:

Sub NamedRangeList()
Dim NamedRange As Name
Dim Roww As Integer

Range("A:C").Clear ' blow off existing stuff
Range("A1") = "Name" ' Heading
Range("B1") = "Refers to"
Range("C1") = "Contents"

Roww = 2
For Each NamedRange In Names
Cells(Roww, 1) = NamedRange.Name
Cells(Roww, 2) = "'" & NamedRange.RefersTo
Cells(Roww, 3) = ActiveSheet.Range(NamedRange.Name).Value

Roww = Roww + 1
Next NamedRange
End Sub


I haven't seen it, but you may well be better off with Jan's Name Manager.
--
Earl Kiosterud
www.smokeylake.com
-----------------------------------------------------------------------
"Earl Kiosterud" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Learner,
>
> Paste this from here into a module. Watch for email-induced line feeds.
> If there are more than 65K names, it will auger in.
>
> Sub NamedRangeList()
> Dim NamedRange As Name
> Dim Roww As integer
>
> Range("A:B").ClearContents ' blow off existing stuff
> Range("A1") = "Name" ' Heading
> Range("B1") = "Refers to"
> Roww = 2
> For Each NamedRange In Names
> Cells(Roww, 1) = NamedRange.Name
> Cells(Roww, 2) = "'" & NamedRange.RefersTo
> Roww = Roww + 1
> Next NamedRange
> End Sub
> --
> Earl Kiosterud
> www.smokeylake.com
> -----------------------------------------------------------------------
> "learner" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Hi,
>>
>> I have an excel sheet which has a number of named cells (say NM1, NM2,
>> NM3, etc). I do not use all the names everytime. Is there a way to
>> check from a macro if a named range is being used in the active sheet
>> or not ?
>>
>> Any help would be appreciated !
>>

>
>



 
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
Checking a cell against a named range =?Utf-8?B?TWVtZW50bw==?= Microsoft Excel Worksheet Functions 8 7th Apr 2007 01:46 PM
checking value of named range mark kubicki Microsoft Excel Programming 4 31st Oct 2006 07:09 PM
Checking for non-blank cells in named range =?Utf-8?B?QmFyYiBSZWluaGFyZHQ=?= Microsoft Excel Programming 2 13th Oct 2006 06:34 PM
Checking for non blank cells in named range =?Utf-8?B?QmFyYiBSZWluaGFyZHQ=?= Microsoft Excel Programming 1 13th Oct 2006 03:32 PM
Checking for non-blank cells in named range =?Utf-8?B?QmFyYiBSZWluaGFyZHQ=?= Microsoft Excel Programming 0 13th Oct 2006 02:42 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:52 AM.