PC Review


Reply
Thread Tools Rate Thread

Determing range name that is tied to the active cell

 
 
=?Utf-8?B?QmFyYiBSZWluaGFyZHQ=?=
Guest
Posts: n/a
 
      7th Nov 2006
Programmatically, I'd like to be able to determine the range name that is
tied to the active cell. How would I do that?

Thanks
 
Reply With Quote
 
 
 
 
Don Guillett
Guest
Posts: n/a
 
      7th Nov 2006

sub cellname()
msgbox active.cell.name
end sub
--
Don Guillett
SalesAid Software
(E-Mail Removed)
"Barb Reinhardt" <(E-Mail Removed)> wrote in message
news:90AC4F41-A29C-417F-95BD-(E-Mail Removed)...
> Programmatically, I'd like to be able to determine the range name that is
> tied to the active cell. How would I do that?
>
> Thanks



 
Reply With Quote
 
=?Utf-8?B?R2FyeScncyBTdHVkZW50?=
Guest
Posts: n/a
 
      7th Nov 2006
Sub demp2()
Dim n As Name
For Each n In ActiveWorkbook.Names
If Intersect(ActiveCell, Range(n.Name)) Is Nothing Then
Else
MsgBox (n.Name)
End If
Next
End Sub


--
Gary''s Student


"Barb Reinhardt" wrote:

> Programmatically, I'd like to be able to determine the range name that is
> tied to the active cell. How would I do that?
>
> Thanks

 
Reply With Quote
 
Norman Jones
Guest
Posts: n/a
 
      7th Nov 2006
Hi Barbara,

Try:

'=============>>
Public Sub Tester()
Dim sStr As String

On Error Resume Next
sStr = Range("A1").Name.Name
If Err.Number = 0 Then
MsgBox sStr
End If
On Error GoTo 0

End Sub
'<<=============


---
Regards,
Norman


"Barb Reinhardt" <(E-Mail Removed)> wrote in message
news:90AC4F41-A29C-417F-95BD-(E-Mail Removed)...
> Programmatically, I'd like to be able to determine the range name that is
> tied to the active cell. How would I do that?
>
> Thanks



 
Reply With Quote
 
=?Utf-8?B?R2FyeScncyBTdHVkZW50?=
Guest
Posts: n/a
 
      7th Nov 2006
Hi Norm:

What happens if there are several Named Ranges that include cell A1?
--
Gary's Student


"Norman Jones" wrote:

> Hi Barbara,
>
> Try:
>
> '=============>>
> Public Sub Tester()
> Dim sStr As String
>
> On Error Resume Next
> sStr = Range("A1").Name.Name
> If Err.Number = 0 Then
> MsgBox sStr
> End If
> On Error GoTo 0
>
> End Sub
> '<<=============
>
>
> ---
> Regards,
> Norman
>
>
> "Barb Reinhardt" <(E-Mail Removed)> wrote in message
> news:90AC4F41-A29C-417F-95BD-(E-Mail Removed)...
> > Programmatically, I'd like to be able to determine the range name that is
> > tied to the active cell. How would I do that?
> >
> > Thanks

>
>
>

 
Reply With Quote
 
Norman Jones
Guest
Posts: n/a
 
      7th Nov 2006
Hi Gary,

> What happens if there are several Named Ranges that include cell A1?


The first name (alphabetically) wpould be returned.

To return possible multiple names, it would be necessary to loop, as
suggested by you, and test that the name range and the cell/range were
identical.


---
Regards,
Norman



"Gary''s Student" <(E-Mail Removed)> wrote in message
news:7CFD394B-2202-4288-8E8C-(E-Mail Removed)...
> Hi Norm:
>
> What happens if there are several Named Ranges that include cell A1?
> --
> Gary's Student
>
>
> "Norman Jones" wrote:
>
>> Hi Barbara,
>>
>> Try:
>>
>> '=============>>
>> Public Sub Tester()
>> Dim sStr As String
>>
>> On Error Resume Next
>> sStr = Range("A1").Name.Name
>> If Err.Number = 0 Then
>> MsgBox sStr
>> End If
>> On Error GoTo 0
>>
>> End Sub
>> '<<=============
>>
>>
>> ---
>> Regards,
>> Norman
>>
>>
>> "Barb Reinhardt" <(E-Mail Removed)> wrote in
>> message
>> news:90AC4F41-A29C-417F-95BD-(E-Mail Removed)...
>> > Programmatically, I'd like to be able to determine the range name that
>> > is
>> > tied to the active cell. How would I do that?
>> >
>> > Thanks

>>
>>
>>



 
Reply With Quote
 
Don Guillett
Guest
Posts: n/a
 
      7th Nov 2006
typo
msgbox activecell.name

--
Don Guillett
SalesAid Software
(E-Mail Removed)
"Don Guillett" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> sub cellname()
> msgbox active.cell.name
> end sub
> --
> Don Guillett
> SalesAid Software
> (E-Mail Removed)
> "Barb Reinhardt" <(E-Mail Removed)> wrote in
> message news:90AC4F41-A29C-417F-95BD-(E-Mail Removed)...
>> Programmatically, I'd like to be able to determine the range name that is
>> tied to the active cell. How would I do that?
>>
>> Thanks

>
>



 
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
getting the selected range and active cell of a non active worksheetsheet GerryGerry Microsoft Excel Programming 7 23rd Sep 2009 05:22 PM
Sum Every 4th column in a range tied to a control cell stvn.taylor@gmail.com Microsoft Excel Worksheet Functions 1 19th Aug 2008 03:25 AM
macro to select range from active cell range name string aelbob Microsoft Excel Programming 2 14th Jul 2008 09:19 PM
Determing active form to process function scott Microsoft Access Form Coding 4 27th Jan 2008 09:25 PM
Determing Range Criteria =?Utf-8?B?SmltIEFrc2Vs?= Microsoft Excel Worksheet Functions 11 18th Sep 2007 09:34 PM


Features
 

Advertising
 

Newsgroups
 


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