+ Reply to Thread
Results 1 to 5 of 5

Populate Cell with Assigned Cell Name

Hybrid View

Toner Populate Cell with Assigned... 10-23-2012, 10:02 AM
brynbaker Re: Populate Cell with... 10-23-2012, 02:11 PM
Toner Re: Populate Cell with... 10-23-2012, 04:10 PM
brynbaker Re: Populate Cell with... 10-24-2012, 12:12 AM
FDibbins Re: Populate Cell with... 10-24-2012, 12:30 AM
  1. #1
    Registered User
    Join Date
    03-01-2012
    Location
    Birmingham, AL
    MS-Off Ver
    2010
    Posts
    4

    Populate Cell with Assigned Cell Name

    Good Morning,

    I have a workbook that contains ten worksheets and within those worksheets, I used code to name hundreds of specific cells. See a small sample of the code below:

    ThisWorkbook.Names.Add Name:="CDS_A0.A", _
    RefersTo:=Worksheets("CDS-A").Range("D4")
    ThisWorkbook.Names.Add Name:="CDS_A0.B", _
    RefersTo:=Worksheets("CDS-A").Range("D5")
    ThisWorkbook.Names.Add Name:="CDS_A0.C", _
    RefersTo:=Worksheets("CDS-A").Range("D6")
    ThisWorkbook.Names.Add Name:="CDS_A0.D", _
    RefersTo:=Worksheets("CDS-A").Range("D7")
    ThisWorkbook.Names.Add Name:="CDS_A0.E", _
    RefersTo:=Worksheets("CDS-A").Range("D8")
    ThisWorkbook.Names.Add Name:="CDS_A0.F", _
    RefersTo:=Worksheets("CDS-A").Range("D9")
    ThisWorkbook.Names.Add Name:="CDS_A0.G", _
    RefersTo:=Worksheets("CDS-A").Range("D10")
    ThisWorkbook.Names.Add Name:="CDS_A0.H", _
    RefersTo:=Worksheets("CDS-A").Range("D11")
    What I would like to do now is populate the cells with the name. For the example above, I would like "CDS_A0.A" to be put into the cell "D4" in worksheet "CDS-A".

    I would also like to highlight the cells a color to make them stand out.

    I have a separate worksheet that contains all the worksheet names, ranges and cell names used to create the "name".

    I have searched but cannot find anything like what I am trying to do.

    I appreciate you all looking at this!

  2. #2
    Forum Contributor
    Join Date
    10-18-2012
    Location
    Telford, England
    MS-Off Ver
    Excel 2010 (2003)
    Posts
    294

    Re: Populate Cell with Assigned Cell Name

    Well clearly you can make a set of code from a list. So all you need is the VBA. Here is the code for the first cell:
    [CDS_A0.A] = "CDS_A0.A"    ' place the name in the cell
    CDS_A0.A.interior.colorindex = 3' highlight the cell in yellow
    This is 2003 VBA; it wull work in 2010 but you have more colour options available.

    Of course if all the cells are highlighted the same colour they won't stand out.

  3. #3
    Registered User
    Join Date
    03-01-2012
    Location
    Birmingham, AL
    MS-Off Ver
    2010
    Posts
    4

    Re: Populate Cell with Assigned Cell Name

    Thank you, this is just what I needed and a big help!

    Note, the second line should be:

    [CDS_A0.A].Interior.ColorIndex = 3

  4. #4
    Forum Contributor
    Join Date
    10-18-2012
    Location
    Telford, England
    MS-Off Ver
    Excel 2010 (2003)
    Posts
    294

    Re: Populate Cell with Assigned Cell Name

    Of course it should. Happy to help

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,049

    Re: Populate Cell with Assigned Cell Name

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Also, as a relatively new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1