|
Sub 过程名()
Dim dic
Set dic = CreateObject("scripting.dictionary")
For i = 2 To Sheet1.Range("A" & Rows.Count).End(xlUp).Row
If Sheet1.Cells(i, 1) <> "" And Sheet1.Cells(i, 2) = "Y" Then
关键字 = Sheet1.Cells(i, 1) & Sheet1.Cells(i, 3)
dic(关键字) = dic(关键字) + Sheet1.Cells(i, 5)
End If
If Sheet1.Cells(i, 1) <> "" Then
关键字 = Sheet1.Cells(i, 4) & Sheet1.Cells(i, 3)
dic(关键字) = dic(关键字) + Sheet1.Cells(i, 5)
End If
Next
jg = dic("江苏省区2023/2/18")
For i = 4 To Sheet2.Range("A" & Rows.Count).End(xlUp).Row
If Sheet2.Cells(i, 1) <> "" And Left(Sheet2.Cells(i, 1).Value, 2) <> "库房" Then
For j = 2 To 6
关键字1 = Sheet2.Cells(i, 1) & Sheet2.Cells(1, j)
Sheet2.Cells(i, j) = dic(关键字1)
Next
End If
Next
End Sub |
|