troubleshooting Question

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

Avatar of AndresHernando
AndresHernando asked on
Microsoft Excel
2 Comments1 Solution387 ViewsLast Modified:
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
sshah254

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros