- ©«¤l
- 552
- ¥DÃD
- 3
- ºëµØ
- 0
- ¿n¤À
- 578
- ÂI¦W
- 0
- §@·~¨t²Î
- win7
- ³nÅ骩¥»
- office 2010
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2015-2-8
- ³Ì«áµn¿ý
- 2024-7-9
|
¦^´_ 2# lcctno
§Aªº¼Æ¾Ú¥Î¤@¯ë±Æ§Ç´N¥i¥H°µ¨ì¤F°Ú¡I¤£À´¬°¤°»òn¼g¦¨µ{¦¡¡H- Option Base 1
- Public Sub Ex()
- Set d = CreateObject("scripting.dictionary")
- aa = Cells(Rows.Count, 1).End(xlUp).Row
- bb = Cells(Rows.Count, 2).End(xlUp).Row
- Dim ar1()
- If aa < 2 Or bb < 2 Then Exit Sub
- If aa > bb Then
- arr = Range("A3:B" & aa)
- Else
- arr = Range("A3:B" & bb)
- End If
- For i = 1 To UBound(arr) - 1
- For j = i + 1 To UBound(arr)
- If arr(i, 2) > arr(j, 2) Then
- r1 = arr(i, 1)
- r2 = arr(i, 2)
- arr(i, 1) = arr(j, 1)
- arr(i, 2) = arr(j, 2)
- arr(j, 1) = r1
- arr(j, 2) = r2
-
- End If
- Next
- Next
- For i = 1 To UBound(arr)
- If arr(i, 1) <> "" And arr(i, 2) <> "" Then
- n = n + 1
- ReDim Preserve ar1(1 To 2, n)
- ar1(1, n) = arr(i, 1)
- ar1(2, n) = arr(i, 2)
- End If
- Next
- [e3].Resize(UBound(ar1, 2), 2) = Application.Transpose(ar1)
- End Sub
½Æ»s¥N½X |
|