ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Determing range name that is tied to the active cell (https://www.excelbanter.com/excel-programming/376908-determing-range-name-tied-active-cell.html)

Barb Reinhardt

Determing range name that is tied to the active cell
 
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

Don Guillett

Determing range name that is tied to the active cell
 

sub cellname()
msgbox active.cell.name
end sub
--
Don Guillett
SalesAid Software

"Barb Reinhardt" wrote in message
...
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




Gary''s Student

Determing range name that is tied to the active cell
 
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


Norman Jones

Determing range name that is tied to the active cell
 
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" wrote in message
...
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




Gary''s Student

Determing range name that is tied to the active cell
 
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" wrote in message
...
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





Norman Jones

Determing range name that is tied to the active cell
 
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" wrote in message
...
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" wrote in
message
...
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







Don Guillett

Determing range name that is tied to the active cell
 
typo
msgbox activecell.name

--
Don Guillett
SalesAid Software

"Don Guillett" wrote in message
...

sub cellname()
msgbox active.cell.name
end sub
--
Don Guillett
SalesAid Software

"Barb Reinhardt" wrote in
message ...
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







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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com