尝试运行一个返回不同的单元格值从一个工作表到另一个工作表单单元格基于多个条件匹配(smth接近textjoin/filter函数)
这是我想运行的代码
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
1条答案
按热度按时间blpfk2vs1#
试试看吧