+ Reply to Thread
Results 1 to 3 of 3

Retrieving the address of a cell in a range

  1. #1
    Registered User
    Join Date
    08-27-2014
    Location
    Albany, NY
    MS-Off Ver
    Office 2010
    Posts
    91

    Retrieving the address of a cell in a range

    I am trying to retrieve the address of a cell in a selected range so it can be compared to the current input. If they are the same, the Loop is broken and the code moves on. (If GetFullAddress = GetDefaultCell then exit loop as below

    Please Login or Register  to view this content.
    The ranges chosen by the user are limitless, so this check helps end the loop:

    GetFullAddress is working perfectly:

    Please Login or Register  to view this content.
    But no matter how hard I try I cannot get the variable firstCell to read anything other than "1", which is the cell value. I tried reading the address into a string ( firstCellString = CStr(UserRanges.Item(UserRanges.Count).Cells(1, 1).Address) ) and converting it to a range (firstCell = Range(firstCellString)). In this case firstCellString returns "$A$1" but when i pass it through the second step firstCell = 1. I need first cell to be $A$1 help?

    Please Login or Register  to view this content.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Retrieving the address of a cell in a range

    First of all, GetFullAddress is not working perfectly. It is missing the closing ' . It should be

    Please Login or Register  to view this content.
    Second, it's difficult to understand what you're really trying to do based on your description but I think you're getting tangled up trying to extract an address as a string, convert it to a Range, then somehow get a string back out of that. This is the code you really want:

    Please Login or Register  to view this content.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Registered User
    Join Date
    08-27-2014
    Location
    Albany, NY
    MS-Off Ver
    Office 2010
    Posts
    91

    Re: Retrieving the address of a cell in a range

    That worked, I had assumed it was the GetDefaultCell when all along it was the GetFullAddress...I'm glad I put that up there. I would have banged my head against that for hours.

+ 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. Replies: 0
    Last Post: 09-04-2009, 06:11 PM
  2. retrieving cell address matching condition
    By yoniman in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-12-2009, 04:11 PM
  3. Replies: 23
    Last Post: 10-03-2007, 04:28 PM
  4. Retrieving the Cell Address of the Largest Value in a Range
    By nishantkhimesra in forum Tips and Tutorials
    Replies: 1
    Last Post: 08-23-2005, 04:20 AM
  5. [SOLVED] Retrieving all precedents address
    By Michel GLOD in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-18-2005, 10:06 AM

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