So I attempted to add an "And" after the then so pull more but I keep getting a Loop Without Do error....
But if I end just the if statement and add another if statement based off the answer from the first it works perfectly heh
Option Explicit
Sub test()
Dim lrow As Long, arr2search, resultarr, i As Long, j As Long, c As Range, firstAddress As String, tempvalue As String
lrow = Cells(Rows.Count, 1).End(xlUp).Row
If lrow = 1 And Range("a1") = "" Then Exit Sub
arr2search = Range("a1:b" & lrow)
ReDim resultarr(1 To lrow, 1 To 3)
For i = 1 To lrow
If Trim(arr2search(i, 1)) <> "" Then
tempvalue = Trim(arr2search(i, 1))
j = j + 1
resultarr(j, 1) = tempvalue
With Sheets("Data").UsedRange
Set c = .Find(tempvalue, , xlValues, xlWhole)
If Not c Is Nothing Then
firstAddress = c.Address
Do
If c.Value > resultarr(j, 3) Then
resultarr(j, 3) = c.Offset(, 2).Value
End If
If c.Value > resultarr(j, 3) Then
resultarr(j, 2) = c.Offset(, -2).Value
End If
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If
End With
End If
Next
Sheets.Add.Range("a8").Resize(j, 3) = resultarr
End Sub
Bookmarks