+ Reply to Thread
Results 1 to 4 of 4

.row function altering lookup value?

  1. #1
    Registered User
    Join Date
    02-20-2013
    Location
    Georgia, USA
    MS-Off Ver
    Excel 2010
    Posts
    52

    .row function altering lookup value?

    Excel Forum,

    After numerous posts I am finally getting closer to achieving my objective. Unfortunately, I just noticed an issue in my code that I think is due to the .row function I am using. Please help me find a way to preserve the reference key I am looking up.

    My code is doing a great job searching for and returning the right values, however, the primary key look up value gets altered when I run the code. This would not be a problem, but I need to refer to the reference number more than once in my code.

    In other words, if I am looking up value 4010 in column A, returning the row number and then using that row number and a static column number to return a value in my sheet, that works great. However, after running the code, the original lookup value, 4010 is changed to the row number. Later in the code when I look for 4010 again, I will not be able to find it.

    Ultimately, my goal is to pull a few key values from my sheet and then inset them into a model in another workbook. Attached is a sample worksheet with the code saved and below is a small portion of the code.

    Thank you for your help!

    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: .row function altering lookup value?

    Why do you have this?
    Please Login or Register  to view this content.
    It's not needed and is the reason for what you describe happening.

    For opRentT12 you can use this.
    Please Login or Register  to view this content.
    By the way, that code should go in the Else part of the If...Else...End If.

    If you leave it outside then if the Find fails you'll get an error, even with the original code.
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    02-20-2013
    Location
    Georgia, USA
    MS-Off Ver
    Excel 2010
    Posts
    52

    Re: .row function altering lookup value?

    Thank you!

  4. #4
    Registered User
    Join Date
    02-20-2013
    Location
    Georgia, USA
    MS-Off Ver
    Excel 2010
    Posts
    52

    Re: .row function altering lookup value?

    Thanks again for your help, I worked through it. Sorry for the reply.
    Last edited by Centexcel; 06-27-2013 at 02:21 PM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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