|
<p>我试着写了个宏,你试下:</p><p></p><p>Sub 自动查找()<br/>Dim arr(), arr1(), arr2()</p><p>Dim i, m, n, X As Integer<br/>Sheet1.Range("J1:O60000") = ""<br/> <br/>arr = Sheet1.Range("a7:D1000")<br/>arr1 = Sheet1.Range("h7:i10000")<br/>For n = 1 To UBound(arr, 1) '</p><p>m = Sheet1.Range("k60000").End(xlUp).Row + 1<br/> Sheet1.Cells(m, 11) = arr(n, 1)<br/> Sheet1.Cells(m, 12) = "找不到"<br/> <br/>If arr(n, 1) <> "" Then</p><p> For i = 1 To UBound(arr1, 1)<br/> If arr1(i, 1) = arr(n, 1) Then<br/> Sheet1.Cells(m, 11) = arr(n, 1)<br/> Sheet1.Cells(m, 12) = arr(n, 2)<br/> Sheet1.Cells(m, 13) = arr(n, 3)<br/> Sheet1.Cells(m, 14) = arr(n, 4)<br/> Sheet1.Cells(m, 15) = arr1(i, 2)<br/> m = m + 1<br/> End If<br/> Next i<br/> <br/>End If<br/> <br/>Next n</p><p>Erase arr<br/>Erase arr1<br/>End Sub<br/></p> |
|