PC Review


Reply
Thread Tools Rate Thread

Checking if a cell has a range name

 
 
James Price at Premier
Guest
Posts: n/a
 
      8th Jul 2009

I have a worksheet which has a number of Range names. Each named range
relates to one cell only. There will be no instances of more than one range
name in a cell. Can I use VBA to check if the Active Cell has a range name
in it.

Many thanks

James
 
Reply With Quote
 
 
 
 
Gary''s Student
Guest
Posts: n/a
 
      8th Jul 2009

Try:

Sub WhatsInAName()
On Error GoTo noname
n = ActiveCell.Name
MsgBox ("cell has a name")
Exit Sub
noname:
MsgBox ("cell has no name")
End Sub

--
Gary''s Student - gsnu200858


"James Price at Premier" wrote:

> I have a worksheet which has a number of Range names. Each named range
> relates to one cell only. There will be no instances of more than one range
> name in a cell. Can I use VBA to check if the Active Cell has a range name
> in it.
>
> Many thanks
>
> James

 
Reply With Quote
 
Mike H
Guest
Posts: n/a
 
      8th Jul 2009

Hi,

Try this. You don't need the message boxes, they're to illustrate it works

On Error Resume Next
dummy = ActiveCell.Name.Name
If Len(dummy) = 0 Then
MsgBox "activecell is not in named range"
Else
MsgBox ActiveCell.Name.Name
End If

Mike

"James Price at Premier" wrote:

> I have a worksheet which has a number of Range names. Each named range
> relates to one cell only. There will be no instances of more than one range
> name in a cell. Can I use VBA to check if the Active Cell has a range name
> in it.
>
> Many thanks
>
> James

 
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 one cell, if number is a range then this Jenn Microsoft Excel Worksheet Functions 4 3rd Sep 2009 06:21 PM
Checking a cell against a named range =?Utf-8?B?TWVtZW50bw==?= Microsoft Excel Worksheet Functions 8 7th Apr 2007 01:46 PM
Checking range of cells for entry then checking for total =?Utf-8?B?QmFyYiBSZWluaGFyZHQ=?= Microsoft Excel Programming 1 13th Oct 2006 02:47 PM
Checking if a cell value in one range is contained in a second range? ModelerGirl Microsoft Excel Discussion 4 21st Feb 2006 03:16 PM
Checking/making-positive one cell unchecks other cells in range CL Microsoft Excel Discussion 0 20th Jan 2005 01:41 AM


Features
 

Advertising
 

Newsgroups
 


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