Results 1 to 4 of 4

.row function altering lookup value?

Threaded View

  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!

    ' searches for T-12 income variables
               ' optimum rent
                Set keyRange = Range("a1", Range("a65536").End(xlUp))
                Set keyRow = Columns(1).Find(what:="4010", LookIn:=xlValues, lookat:=xlPart)
                    If keyRow Is Nothing Then
                        MsgBox "not found"
                    Else
                        keyRow = keyRow.Row
                        MsgBox "found on row " & keyRow.Row
                    End If
                opRentT12 = (Cells(keyRow, 15))
    Attached Files Attached Files

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