|
发表于 2016-7-3 20:43
|
显示全部楼层
本楼为最佳答案
自己验证下!- Sub xx()
- Dim arr, i&, n&, n1&, j&
- With Sheet1
- n = .Cells(.Rows.Count, 1).End(xlUp).Row
- arr = .Range("A2:D" & n)
- End With
- Application.ScreenUpdating = False
- With Sheet2
- n1 = .Cells(.Rows.Count, 1).End(xlUp).Row
- .Range("B2:B" & n).ClearContents
- For i = 2 To n1
- For j = 1 To n - 1
- If Replace(.Cells(i, 1), "英", "") = arr(j, 1) And .Cells(i, 3) >= arr(j, 3) And .Cells(i, 4) <= arr(j, 4) Then
- .Cells(i, 2) = arr(j, 2)
- Exit For
- End If
- Next
- Next
- End With
- Application.ScreenUpdating = True
- End Sub
复制代码 |
|