trying to run a VBA that returns different cell values from a worksheet into another worksheet signle cell based on multiple criteria that matches (smth close to textjoin/filter function)
here is a code I was trying to run
Sub FindValues()
Dim lookUpSheet As Worksheet, updateSheet As Worksheet
Dim valueToSearch As String
Dim i As Long
Set lookUpSheet = Worksheets("Test")
Set updateSheet = Worksheets("result")
Worksheets("result").Cells(22, 5).Value = result
For i = 2 To lastRow
If lookUpSheet.Cells(i, 5).Value & lookUpSheet.Cells(i, 2).Value = updateSheet.Range("C22").Value & updateSheet.Range("E21").Value Then
Worksheets("result").Cells(22, 5).Value = lookUpSheet.Cells(i, 1).Value & vbNewLine & lookUpSheet.Cells(i, 3).Value & vbNewLine & lookUpSheet.Cells(i, 4).Value & vbNewLine
End If
Next i
End Sub
Please try.