Consulting

Results 1 to 7 of 7

Thread: Range A1 notation

  1. #1
    VBAX Mentor
    Joined
    Jan 2008
    Posts
    384
    Location

    Range A1 notation

    Hi:
    Is there a Excel Worksheet function that will allow me to convert this format $A$1 to A1.
    OR VBA which will give the activeCell address with sheetname in that Range("A1") notation.



  2. #2
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,724
    Location
    worksheet

    =SUBSTITUTE(CELL("address",A1),"$","")
    VBA

    Activecell.Address(false,false)
    Both return just "A1"

    Edit: Ooops - missed the Sheet Name part
    Last edited by Paul_Hossler; 01-11-2020 at 08:32 AM.
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  3. #3
    Knowledge Base Approver VBAX Wizard
    Joined
    Apr 2012
    Posts
    5,642
    In Excel:

    PHP Code:
    =ADDRESS(1;1;4
    In VBA

    PHP Code:
    msgbox activecell.address(0,0

  4. #4
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,873
    Quote Originally Posted by simora View Post
    VBA which will give the activeCell address with sheetname
    MsgBox Split(ActiveCell.Address(0, 0, external:=True), "]")(1)
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  5. #5
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,873
    Quote Originally Posted by p45cal View Post
    MsgBox Split(ActiveCell.Address(0, 0, external:=True), "]")(1)
    That's a mess with sheet names with spaces in. This seems a bit better:
    MsgBox Split(ActiveCell.Address(0, 0, external:=True), "[")(0) & Split(Split(ActiveCell.Address(0, 0, external:=True), "[")(1), "]")(1)
    Gets even sillier if there's a single quote in the middle of the sheet name.
    Last edited by p45cal; 01-11-2020 at 10:18 AM.
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  6. #6
    Moderator VBAX Sage SamT's Avatar
    Joined
    Oct 2006
    Location
    Near Columbia
    Posts
    7,814
    Location
    MsgBox ActiveSheet.Name & "!" & ActiveCell.Address(0, 0)
    MsgBox Range.Parent.Name & ".Range("" & Range.Address(0, 0) & "")"
    I expect the student to do their homework and find all the errrors I leeve in.


    Please take the time to read the Forum FAQ

  7. #7
    VBAX Mentor
    Joined
    Jan 2008
    Posts
    384
    Location
    Thanks Guys:

    All great ideas & suggestions.

Posting Permissions

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