ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

°õ¦æVBA¤Wªº°ÝÃD(sorting¤£§¹¥þ)

°õ¦æVBA¤Wªº°ÝÃD(sorting¤£§¹¥þ)

°ÝÃD: °õ¦æ®Ésorting¤£§¹¥þ...¥²¶·«ö«Ü¦h¦¸°õ¦æ¤~±Æ§Ç§¹¦¨¡C ÅÞ¿è¤W»yªk¤W³£Àˬd¹L3«K¤F¡AÀ³¸Ó¬O¨S°ÝÃD!  ©Ò¥H²{¦b§Ú¤£ª¾¹D¬O¤°»ò°ÝÃD...¥H©¹¨S¼g¹LVBA¹J¨ì³oºØ°ÝÃD..©Ò¥H¤W¨Ó¶Qª©¨D±Ï

¤pªº¦b¤U§Ú¤µ¤Ñ¼g¤F¤@­Ó¤psorting ±Æ§Ç¤Tµ§¸ê®Æ 5 4 3 2 1
                                                                                              5 4 3 2 1
                                                                                              5 4 3 2 1
¥Ñ¤p±Æ¨ì¤j¦b¬Y¨Ç¯S©wcell¤¤(¤]´N¬O­ì¥»ªº15­Ó®æ¤l)¡A ¥H¤U¬O§Úªºµ{¦¡½X¡A
Sub sorting_order()
Dim temp As Integer


For i = 2 To 4
For j = 7 To 10

If (Worksheets("Sheet1").Cells(i, j).Value > Worksheets("Sheet1").Cells(i, j + 1).Value) Then

temp = Worksheets("Sheet1").Cells(i, j + 1).Value
Worksheets("Sheet1").Cells(i, j + 1).Value = Worksheets("Sheet1").Cells(i, j).Value
Worksheets("Sheet1").Cells(i, j).Value = temp

End If

Next
Next


End Sub

³o¥u¬O¤p¤pªº¤Tµ§±Æ§Ç´ú¸Õ¡A   ¦]¬°§Ú»Ý­n´X¤dµ§ªº±Æ§Ç ­Y«ö§¹°õ¦æ¤£ª¾¦ó®É¥i§¹¾ã§¹¦¨±Æ§Ç«h·|µL¸Ñ= =¡C

½Ð¶Q¤H°ª©ï¶Q¤â¡AÁÂÁ¡C

¥»©«³Ì«á¥Ñ register313 ©ó 2012-4-24 21:30 ½s¿è

¦^´_ 1# m09903020
  1. Sub sorting_order()
  2. C = [G2].End(xlToRight).Column - [G2].Column + 1
  3. For Each G In Range([G2], [G2].End(xlDown))
  4.   G.Resize(1, C).Sort Key1:=G, Order1:=xlAscending, Header:=xlGuess, Orientation:=xlLeftToRight
  5. Next
  6. End Sub
½Æ»s¥N½X
  1. Sub sorting_order()
  2. C = [G2].End(xlToRight).Column - [G2].Column + 1
  3. 'C=G2¦V¥k³Ì«á¤@Ä椧Ä渹-G2Ä渹+1=11-7+1=5Äæ
  4. For Each G In Range([G2], [G2].End(xlDown))
  5. '°j°é:¦@¦³´X¦C­n±Æ§Ç ²Ä1°é:G=G2,²Ä2°é:G=G3...
  6.   G.Resize(1, C).Sort Key1:=G, Order1:=xlAscending, Header:=xlGuess, Orientation:=xlLeftToRight
  7.   'G2ÂX¤j5Äæ§@±Æ§Ç    ±Æ§ÇÁäG2 »¼¼W±Æ§Ç             µL¼ÐÃD           ¨Ì¦C±Æ§Ç
  8.   'G3ÂX¤j5Äæ§@±Æ§Ç    ±Æ§ÇÁäG3 »¼¼W±Æ§Ç             µL¼ÐÃD           ¨Ì¦C±Æ§Ç
  9. Next
  10. End Sub
½Æ»s¥N½X

TOP

¦^´_ 1# m09903020
  1. Option Explicit
  2. Sub sorting_order()
  3. Dim temp As Integer, i As Integer, y As Integer, j As Integer
  4. For i = 2 To 4
  5. For y = 7 To 9              '*****  ¦³¦³4Äæ ­n¶]3 ¦¸   ****
  6. For j = 7 To 9               '­ì¥»¦³4Äæ  ²Ä4Ä椣¥²¶]
  7.    'For j = 7 To 10
  8. If (Worksheets("Sheet1").Cells(i, j).Value > Worksheets("Sheet1").Cells(i, j + 1).Value) Then
  9.    'If j < 10 Then
  10.     temp = Worksheets("Sheet1").Cells(i, j + 1).Value
  11.     Worksheets("Sheet1").Cells(i, j + 1).Value = Worksheets("Sheet1").Cells(i, j).Value
  12.      Worksheets("Sheet1").Cells(i, j).Value = temp
  13.      'End If
  14. End If
  15. Next
  16. Next
  17. Next
  18. End Sub

  19. Sub Ex()
  20. Dim temp As Integer, i As Integer, y As Integer, j As Integer, Ar
  21.     For i = 2 To 4
  22.         Ar = Application.Transpose(Application.Transpose(Range(Cells(i, 7), Cells(i, 10)).Value))
  23.         '±N ¾ã¦Cªº¼Æ­ÈÂà¦Ü¦AÂà¦Ü(¬°¤@ºû°}¦C) ¾É¤J °}¦C
  24.        '¤u§@ªí¨ç¼Æ Small ¥i¦b¤@ºû°}¦C¤¤¶Ç¦^ «ü©w±Æ§Ç²Ä´X­Óªº  ³Ì¤p­È  
  25.         For y = 7 To 10
  26.            Cells(i, y) = Application.Small(Ar, y - 6)  '±N °}¦C ­È¥Ñ³Ì¤p¶}©l±Æ¦C
  27.         Next
  28.     Next
  29. End Sub
½Æ»s¥N½X

TOP

¦^´_ 3# GBKEE


    ÁÂÁª©¤jªº·N¨£¡A

TOP

¦^´_ 2# register313


    ÁÂÁÂR¤jªº·N¨£¡A§Ú­è¸Õrun¤F±zªºµ{¦¡µo²{¥i¥H¶]¡A¸ò§Ú¤§«e°²³]ªºEXCEL½sĶ°ÝÃDµLÃö

    ¥i¥H³Â·Ð§A¼gÂIµù°O¶Ü? ±zªºµ{¦¡ÆZºë²ªº§Ú¬Ý¤£À´  ^^"

TOP

¦^´_ 2# register313


    «D±`ÁÂÁ¡A§Ú¯àÀ³¥Î¦bÃe¤jªº¼Æ¶q¤¤¤F!

TOP

¦^´_ 2# register313
  1. Sub sorting_order()
  2.     Dim G As Range
  3.     For Each G In Range([G2], [G2].End(xlDown)).CurrentRegion.Rows
  4.         G.Sort Key1:=G, Order1:=xlAscending, Header:=xlGuess, Orientation:=xlLeftToRight
  5.     Next
  6. End Sub
½Æ»s¥N½X

TOP

        ÀR«ä¦Û¦b : ¤H¨ÆªºÁ}Ãø»PµZ¿i¡A´N¬O¤@ºØ¦ÒÅç¡C
ªð¦^¦Cªí ¤W¤@¥DÃD