Consulting

Results 1 to 3 of 3

Thread: How to Reference a String in a Cell

  1. #1

    How to Reference a String in a Cell

    Not sure that is the best subject, but this one is a bit odd.

    In Cell A1, I have a string that is another cell, for example A1 has "C5" in it. I want to be able to reference the value that exists in "C5", but from A1. So it might look something like the following?

    Sheet1.Range("string that is in A1")

  2. #2
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,724
    Location
    Use =INDIRECT(A1)

    Not sure what you mean by 'but from A1'

    I want to be able to reference the value that exists in "C5", but from A1.
    This is a worksheet approach. VBA would be slightly different




    Capture.JPG
    ---------------------------------------------------------------------------------------------------------------------

    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
    Great, thanks! I had never heard of "INDIRECT" before. After a search, I found this bit of code will do the trick. I figured there was a native way to do this.

    Sheet1.Range(Sheet2.Range("A1").Value)

Posting Permissions

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