|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub limonet()
Dim Arr As Variant, Brr As Variant, Crr As Variant, Drr As Variant, i%, j%, Tmp$
i = Range("A" & Rows.Count).End(xlUp).Row
Arr = Application.Transpose(Range("A2:A" & i))
Brr = Application.Transpose(Range("B2:B" & i))
Crr = Application.Transpose(Range("C2:C" & i))
Drr = Range("A2:C" & i)
For j = i - 1 To 1 Step -1
Tmp = Drr(j, 2)
If UBound(Filter(Arr, Drr(j, 1))) > 0 Then
If UBound(Filter(Brr, Drr(j, 2))) > 0 Then
If UBound(Filter(Crr, Drr(j, 3))) > 0 Then
Drr(j, 2) = Drr(j, 1)
Brr(j) = Drr(j, 1)
Drr(j, 1) = Drr(j, 3)
Arr(j) = Drr(j, 3)
Drr(j, 3) = Tmp
Crr(j) = Tmp
Else
Drr(j, 2) = Drr(j, 3)
Brr(j) = Drr(j, 3)
Drr(j, 3) = Drr(j, 1)
Crr(j) = Drr(j, 1)
Drr(j, 1) = Tmp
Arr(j) = Tmp
End If
End If
End If
Next j
Range("D2").Resize(i - 1, 3) = Drr
End Sub
|
评分
-
1
查看全部评分
-
|