Hi,
I want to compare the names on Sheet1 (listed vertically) with the names on Sheet2 (listed horizontally). On Sheet2 every Name has numbers listed below. If there is a match then the 2nd smallest number should be copied next to the Name on Sheet1.
Here is my code so far:
Sub Match() Dim wb As Workbook Dim i As Integer Dim number As Integer Dim find As String Dim name As String Dim a As Long Set wb = ThisWorkbook number = Sheets(Sheet2).Cells(1, Columns.Count).End(xlToLeft).Column For i = 1 To number such = Sheets(Sheet2).Cells(6 + i, 4).Value wert = Sheets(Sheet1).Cells(1, 1 + i).Value If find = name Then '--> go to Cell with the Header "name" and copy the 2nd smallest number in the column and paste it on Sheet1 next to "find" End If Next i Application.ScreenUpdating = False Application.Calculation = xlCalculationManual End Sub