Link to home
Start Free TrialLog in
Avatar of AndresHernando
AndresHernando

asked on

Excel VBA - Code for getting the name of a cell?

I'm trying to write code that will return the user names that have been given to cells.

What I tried below gives cell names like 'Sheet1'!$B$10
I actually need the name that has been given to that cell, which in this case happens to be "db1_Rd_PPRnum" (that is, the Name Manager name, not the cell reference)


Sub M_CellNames_Td_db1_CommonInfo()
    Dim rCell As Range
    Dim rRangeWithNamedCells As Range
   
    Set rRangeWithNamedCells = [Td_db1_CommonInfo]
   
    For Each rCell In rRangeWithNamedCells
        Cells([c_db1_CommonInfo_CellNames_Cell1].Row, rCell.Column).Value = rCell.Name
        Next rCell
End Sub
ASKER CERTIFIED SOLUTION
Avatar of sshah254
sshah254

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of AndresHernando
AndresHernando

ASKER

Shah254,
Nice!!!!  

Thanks, --Andres