Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Checking if a cell has a range name


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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default Checking if a cell has a range name


One way:


Sub dk()
MsgBox ActiveCell.Name.Name
End Sub


"James Price at Premier"
wrote in message ...
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default Checking if a cell has a range name


Or:

Range("J10").Select
ActiveCell.FormulaR1C1 = Range("Y1"),Value
Range("J11").Select
ActiveCell.FormulaR1C1 = Range("Y2").Value




"JLGWhiz" wrote in message
...
One way:


Sub dk()
MsgBox ActiveCell.Name.Name
End Sub


"James Price at Premier"
wrote in message
...
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





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Checking if a cell has a range name


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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default Checking if a cell has a range name


Disregard second posting, wrong thread.


"JLGWhiz" wrote in message
...
Or:

Range("J10").Select
ActiveCell.FormulaR1C1 = Range("Y1"),Value
Range("J11").Select
ActiveCell.FormulaR1C1 = Range("Y2").Value




"JLGWhiz" wrote in message
...
One way:


Sub dk()
MsgBox ActiveCell.Name.Name
End Sub


"James Price at Premier"
wrote in message
...
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









  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,501
Default Checking if a cell has a range name


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
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
Checking one cell, if number is a range then this Jenn Excel Worksheet Functions 4 September 3rd 09 06:21 PM
Spell Checking with checking cell notes jfitzpat Excel Discussion (Misc queries) 0 August 8th 07 10:26 PM
Checking a cell against a named range Memento Excel Worksheet Functions 8 April 7th 07 01:46 PM
Checking a range with IF Rob J Excel Discussion (Misc queries) 4 October 18th 06 05:44 PM
Checking range of cells for entry then checking for total Barb Reinhardt Excel Programming 1 October 13th 06 02:47 PM


All times are GMT +1. The time now is 08:15 PM.

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

About Us

"It's about Microsoft Excel"