+ Reply to Thread
Results 1 to 8 of 8

Neater way of getting "name" of cell?

Hybrid View

  1. #1
    Registered User
    Join Date
    08-01-2009
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    76

    Neater way of getting "name" of cell?

    I'm not sure what you would call it ... "name"? "index"? "grid reference"?

    Anyway, here's what I mean:

    Let's say I select a cell thus:

    Set mycell  = Cells(20, 42)
    This is cell "AP20"

    Let's say I now pass mycell to a function as an argument.

    How to I get the name/index/grid reference (whatever it is called) "AP20" from the object mycell?

  2. #2
    Registered User
    Join Date
    08-01-2009
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    76

    Neater way of getting "name" of cell?

    I'm not sure what you would call it ... "name"? "index"? "grid reference"?

    Anyway, here's what I mean:

    Let's say I select a cell thus:

    Set mycell  = Cells(20, 42)
    This is cell "AP20"

    Let's say I now pass mycell to a function as an argument.

    How to I get the name/index/grid reference (whatever it is called) "AP20" from the object mycell?

    I can do it thus:

    cellName = Chr$(mycell.column + 64) & CStr(mycell.Row)
    But is there a neater way?

  3. #3
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Neater way of getting "name" of cell?

    Hi X,

    Try:
    cellName = mycell.Address(False,False)
    The 'False' statements inhibit the '$' from appearing in the string.

    Lewis

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Neater way of getting "name" of cell?

    Unfortunately this is a duplicate post and as such does not comply with Rule 5 of our forum rules. This thread will now be closed, you may continue in your other thread.

    Please note

    Thread Closed.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  5. #5
    Forum Guru Izandol's Avatar
    Join Date
    03-29-2012
    Location
    *
    MS-Off Ver
    Excel 20(03|10|13)
    Posts
    2,581

    Re: Neater way of getting "name" of cell?

    mycell.Address(0,0)
    for example.
    • Please remember to mark threads Solved with Thread Tools link at top of page.
    • Please use code tags when posting code: [code]Place your code here[/code]
    • Please read Forum Rules

  6. #6
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Neater way of getting "name" of cell?

    Hello XmisterIS,

    You can use the Address property. Your variable has been assigned to a Range object.
        CellName = mycell.Address
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  7. #7
    Registered User
    Join Date
    08-01-2009
    Location
    UK
    MS-Off Ver
    Excel 2007
    Posts
    76

    Re: Neater way of getting "name" of cell?

    tnanks both!

  8. #8
    Forum Expert Fotis1991's Avatar
    Join Date
    10-11-2011
    Location
    Athens(The homeland of the Democracy!). Greece
    MS-Off Ver
    Excel 1997!&2003 & 2007&2010
    Posts
    13,744

    Re: Neater way of getting "name" of cell?

    I merged the two same threads...
    Regards

    Fotis.

    -This is my Greek whisper to Europe.

    --Remember, saying thanks only takes a second or two. Click the little star * below, to give some Rep if you think an answer deserves it.

    Advanced Excel Techniques: http://excelxor.com/

    --KISS(Keep it simple Stupid)

    --Bring them back.

    ---See about Acropolis of Athens.

    --Visit Greece.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] VBA help needed to remove all "/" then replace with "-" from cell "B3"and "B5"
    By krjoshi in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-17-2014, 02:11 PM
  2. [SOLVED] If there is any text in column "A$" on "sheet1" then move cell to column "A$" on "sheet2"
    By ckgeary in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-27-2013, 08:28 PM
  3. [SOLVED] Data validation: allow entry into a cell if other three cells have "X", "Y" and "Z"?
    By RogerRangeRover in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-05-2013, 04:49 AM
  4. [SOLVED] Neater "=if "transaction
    By billy_bags in forum Excel General
    Replies: 5
    Last Post: 05-29-2006, 03:10 PM
  5. Replies: 1
    Last Post: 01-30-2006, 06:10 PM

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