Retrieving a Name of Cell

C

cheesey_toastie

I wish to replace the cell references in a series of formulas with the
cells name.

For Each rngcell In rngRange
strFormula = rngcell.Formula
'and if the the formula begins with a '=' and DOES NOT contain a
'.'
If Left(strFormula, 1) = "=" And InStr(1, strFormula, ".") = 0
Then
'Then we need to iteratively replace each cell reference with a
name reference...

If InStr(strFormula, "+") = 0 Then ' then it is just in the
form '=A34'
Set rngcell2 =
shtCurrent.Range(Right(strFormula, Len(strFormula) - 1))
msgbox rngcell2.Name ' I would hope this returned the
cells name (e.g. TotalSales)

'here i will manipulate the string and replace the cell reference with
a named ref.
End if

Next

The problem is that the rngCell2.Name returns the cells other name
(e.g. SheetName!$A$34)

How do I get the given name?

Many thanks for any help
steve
 
C

cheesey_toastie

Found it....

very very very simple!!!

rngCell2.Name.Name

Hope this helps someone else!

Steve
 

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

Top