- ©«¤l
- 522
- ¥DÃD
- 36
- ºëµØ
- 1
- ¿n¤À
- 603
- ÂI¦W
- 0
- §@·~¨t²Î
- win xp sp3
- ³nÅ骩¥»
- Office 2003
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2012-12-13
- ³Ì«áµn¿ý
- 2021-7-11
|
¦^´_ 7# flying008
¤j¤j§A¦n:
¤½¦¡§Ú¥¿¦b¾Ç, ½Ð¸Õ¸Õvba- Private Sub CommandButton1_Click()
- Dim sh As Worksheet, i, ¼Æ¶q As Integer, rngA As Range
- Set sh = ThisWorkbook.Sheets("Sheet1")
- ¼Æ¶q = sh.[A1].End(xlDown).Row - 1
- sh.[D2].Resize(¼Æ¶q, 2) = ""
- sh.[A2].Resize(¼Æ¶q, 3).Sort _
- Key1:=Range("B2"), _
- Key2:=Range("A2"), _
- Order1:=xlAscending, _
- Order2:=xlAscending, _
- Header:=xlNo
- sh.[D2].Resize(1, 2).Value = sh.[A2].Resize(1, 2).Value
- For i = 3 To ¼Æ¶q + 1
- If sh.Cells(i, 1) <> Cells(i - 1, 1) Then
- sh.Cells(sh.[D1].End(xlDown).Row + 1, 4).Resize(1, 2).Value = sh.Cells(i, 1).Resize(1, 2).Value
- ElseIf sh.Cells(i, 1) = Cells(i - 1, 1) And sh.Cells(i, 2) <> Cells(i - 1, 2) Then
- sh.Cells(sh.[D1].End(xlDown).Row + 1, 4).Resize(1, 2).Value = sh.Cells(i, 1).Resize(1, 2).Value
- End If
- Next
- sh.[D2].Resize(¼Æ¶q, 2).Sort _
- Key1:=Range("D2"), _
- Order1:=xlAscending, _
- Header:=xlNo
- End Sub
½Æ»s¥N½X |
|