|
<p>Sub 物品1有物品2没有()<br/> Range("e2:e65536") = ""<br/> Dim arr1, arr2, z%, x%, y%<br/> arr1 = Range("a2:a" & [a65536].End(xlUp).Row)<br/> arr2 = Range("b2:b" & [b65536].End(xlUp).Row)<br/> For y = 1 To [a65536].End(xlUp).Row - 1<br/> For x = 1 To [a65536].End(xlUp).Row - 1<br/> z = [e65536].End(xlUp).Row + 1<br/> If arr1(y, 1) = arr2(x, 1) Then GoTo 100<br/> Next<br/> Range("e" & z) = arr1(y, 1)<br/>100:<br/> Next<br/>End Sub</p><p>Sub 物品2有物品1没有()<br/> Range("f2:f65536") = ""<br/> Dim arr1, arr2, z%, x%, y%<br/> arr1 = Range("a2:a" & [a65536].End(xlUp).Row)<br/> arr2 = Range("b2:b" & [b65536].End(xlUp).Row)<br/> For y = 1 To [b65536].End(xlUp).Row - 1<br/> For x = 1 To [a65536].End(xlUp).Row - 1<br/> z = [f65536].End(xlUp).Row + 1<br/> If arr2(x, 1) = arr1(y, 1) Then GoTo 100<br/> Next<br/> Range("f" & z) = arr2(y, 1)<br/>100:<br/> Next<br/>End Sub<br/></p> |
|