Retrieving a Name of Cell

  • Thread starter Thread starter cheesey_toastie
  • Start date Start date
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
 
Found it....

very very very simple!!!

rngCell2.Name.Name

Hope this helps someone else!

Steve
 
Back
Top