• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Finding second value in Excel column using offset, index and match

carpegc

New Member
I have the below that only finds the first value.
Code for textboxes in UserForm:

Code:
 With Worksheets("Active Sales Orders")
Dim rng As Range
    Set tbl = Worksheets("Active Sales Orders").ListObjects("SOTable")
    Set rng = tbl.ListColumns(1).DataBodyRange
 
 
 Set f = .Range("SOTable").Find(lstSales.value, , xlValues, xlWhole)
    If Not f Is Nothing Then

Populate 1st value =
txtFB.value = f.Offset(, 19)

Populate 2nd value =
Dim modelRange As Range
Set modelRange = Range("SOTable[Freight Booking]")
Do
    DoEvents
    Application.Calculate
Loop While Not Application.CalculationState = xlDone
Me.txtFB2.value = WorksheetFunction.Index(modelRange, WorksheetFunction.Match(Me.lstSales.Text, Range("SOTable[Document]"), f.Offset(, 19)))

I apologize if this makes no sense.
 
Last edited:
Back
Top