|
- Sub test()
- Dim arr
- Dim d As Object
- Dim i As Long, j As Long
- Dim s1, s2
- Application.ScreenUpdating = False
- Set d = CreateObject("scripting.dictionary")
- For j = 9 To 12 Step 3
- s1 = Cells(1, j).Value
- For i = 3 To 33
- If Cells(i, j + 1) > 0 Then
- s2 = Cells(i, j + 1)
- End If
- d(s1 & Cells(i, j).Value) = s2
- Next
- Next
- arr = Range("i3:i33")
- For i = 1 To UBound(arr)
- d("EMS" & arr(i, 1)) = 20
- Next
- For i = 2 To Range("a1").CurrentRegion.Rows.Count
- For j = 1 To UBound(arr)
- If Cells(i, 1) Like "*" & arr(j, 1) & "*" Then
- Cells(i, 4) = arr(j, 1)
- If Cells(i, 1) Like "*圆通*" Then
- Cells(i, 3) = "圆通"
- ElseIf Cells(i, 1) Like "*申通*" Then
- Cells(i, 3) = "申通"
- Else
- Cells(i, 3) = "EMS"
- End If
- Cells(i, 2) = d(Cells(i, 3).Value & Cells(i, 4).Value)
- End If
- Next
- Next
- Application.ScreenUpdating = True
- End Sub
复制代码 |
|