checking if a range has a name.

  • Thread starter Thread starter Peter
  • Start date Start date
P

Peter

Hello everyone,

Let's say I have given the name "automobile" to cell B7.
If that cell is selected at a certain moment, is is possible to retrieve the
name "automobile" that has been given to it?

I'd like to do something along the lines of (free styling) :
if the name of the active cell =
"automobile" then .... etc. etc.

Does anyone have code for this kind of thing?

Thanks,
Peter
 
Maybe:

Option Explicit
Sub testme()

Dim myName As String
myName = ""
On Error Resume Next
myName = ActiveCell.Name.Name
On Error GoTo 0

If myName = "" Then
MsgBox "no name"
Else
MsgBox "It's: " & myName
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top