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

¨D°Ý­ì¦]¡G±Æ§Ç4­Ókey¥X²{Error, 3­Ókey ¨S°ÝÃD

¨D°Ý­ì¦]¡G±Æ§Ç4­Ókey¥X²{Error, 3­Ókey ¨S°ÝÃD

  1. Letter = "G"
  2. Worksheets("Backup").Range("A2:BB65536").sort Key1:=Range("D3"), Order1:=xlAscending, _
  3.                          Key2:=Range("A3"), Order2:=xlAscending, Key3:=Range(letter & "3"), Order3:=xlAscending, Header:=xlYes


  4. Worksheets("Backup").Range("A2:BB65536").sort Key1:=Range("D3"), Order1:=xlAscending, _
  5.                          Key2:=Range("A3"), Order2:=xlAscending, Key3:=Range("B3"), Order3:=xlAscending, Key4:=Range(letter & "3"), Order4:=xlAscending, Header:=xlYes
½Æ»s¥N½X
¦b°µ±Æ§Ç®É¡A§Ú¨Ï¥Î4­Ókey ´N·|¥X²{Error, ¥u¬O3­ÓKey´N¨S°ÝÃD¡A½Ð°Ý¬O¤°麽­ì¦]

¦^´_ 1# 198188


    «Øij¥Î¿ý»s¥¨¶°ªº¤èªk
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

¦^´_ 2# Andy2483

¤W­±ªº´N¬O¿ý»s¥¨¶°¦Z¡A§Û¨ìµ{¦¡内¡A¥i¬O¹B¦æ®É¥X²{¿ù»~¡C
µM«á§Ú§R¤FKEY4¦Z¡A´N¨S°ÝÃD¤F¡C

TOP

¦^´_ 3# 198188


    «Øij4¼h±Æ§Ç³£¥Î¿ý»sªº¤è¦¡
¥Î¦æ°Ê¸Ë¸mÂsÄý½×¾Â¾Ç²ß«Ü¤è«K,ÁÂÁ½׾¸gÀç¹Î¶¤
½Ð¤j®a¤@°_¤W½×¾Â¨Ó¥æ¬y

TOP

¦b°µ±Æ§Ç®É¡A§Ú¨Ï¥Î4­Ókey ´N·|¥X²{Error, ¥u¬O3­ÓKey´N¨S°ÝÃD¡A½Ð°Ý¬O¤°麽­ì¦]
198188 µoªí©ó 2024-7-19 16:23


½Ð°Ñ¦Ò :
  Range.Sort ¤èªk (Excel)

¦b Sort ªº»yªk»¡©ú¤¤¥i¥H¬Ý¨ì ±Æ§Ç±ø¥ó³Ì¦h¥u¯à¦³ "3" ­Ó
RangrSort»yªk.PNG
2024-8-18 06:52


­Y§A¨Ï¥Î¿ý»s®É¿ï¾Ü¶W¹L3­Ó±Æ§Ç±ø¥óÀ³¸Ó·|µo²{¥¦¨Ï¥Î¥t¥~¤@ºØ»yªk¹ê²{ :
   SortFields
  1.   Dim rTar As Range ' ±Æ§Ç¼Ðªº
  2.   Dim letter As String
  3.   
  4.   letter = "G"
  5.   With Worksheets("Backup").Sort
  6.     Set rTar = .Parent.Range("A2:BB65536")
  7.    
  8.     .SortFields.Clear ' ²M°£±Æ§Ç³]©w
  9.    
  10.     ' rTar.Columns("D") ¨ú rTar Àx¦s®æ½d³ò¼Ðªº¤ºªº D Äæ¸ê®Æ
  11.    
  12.     .SortFields.Add2 Key:=rTar.Columns("D") _
  13.       , SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
  14.    
  15.     .SortFields.Add2 Key:=rTar.Columns("A") _
  16.       , SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
  17.    
  18.     .SortFields.Add2 Key:=rTar.Columns("B") _
  19.       , SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal
  20.    
  21.     .SortFields.Add2 Key:=rTar.Columns(letter) _
  22.       , SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:=xlSortNormal

  23.     .SetRange rTar
  24.     .Header = xlGuess
  25.     .MatchCase = False
  26.     .Orientation = xlTopToBottom
  27.     .SortMethod = xlPinYin
  28.     .Apply ' °õ¦æ±Æ§Ç
  29.   End With
½Æ»s¥N½X

TOP

        ÀR«ä¦Û¦b : ®É®É¦n¤ß´N¬O®É®É¦n¤é¡C
ªð¦^¦Cªí ¤W¤@¥DÃD