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

[µo°Ý] "±Æ§Ç"/"§R°£¾ã¦C"¦³¨S¦³¨ä¥¦ªºµ{¦¡¼gªk?

¦^´_ 11# Hsieh
ª©¤j±z¦n,§Ú¥Îªº¬OExcel 2010 format:
­è¤~©Ò¿ý»sªº±Æ§Ç¬°:
  1.     Windows("BCM Order_Format.xlsx").Activate
  2.     Sheets("PO").Select
  3.     Range("D2").Select
  4.     ActiveWorkbook.Worksheets("PO").AutoFilter.Sort.SortFields.Clear
  5.     ActiveWorkbook.Worksheets("PO").AutoFilter.Sort.SortFields.Add Key:=Range( _
  6.         "D2:D600"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
  7.         xlSortNormal
  8.     ActiveWorkbook.Worksheets("PO").AutoFilter.Sort.SortFields.Add Key:=Range( _
  9.         "Z2:Z600"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
  10.         xlSortNormal
  11.     ActiveWorkbook.Worksheets("PO").AutoFilter.Sort.SortFields.Add Key:=Range( _
  12.         "H2:H600"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
  13.         xlSortNormal
  14.     ActiveWorkbook.Worksheets("PO").AutoFilter.Sort.SortFields.Add Key:=Range( _
  15.         "G2:G600"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
  16.         xlSortNormal
  17.     ActiveWorkbook.Worksheets("PO").AutoFilter.Sort.SortFields.Add Key:=Range( _
  18.         "E2:E600"), SortOn:=xlSortOnValues, Order:=xlAscending, DataOption:= _
  19.         xlSortNormal
  20.     With ActiveWorkbook.Worksheets("PO").AutoFilter.Sort
  21.         .Header = xlYes
  22.         .MatchCase = False
  23.         .Orientation = xlTopToBottom
  24.         .SortMethod = xlPinYin
  25.         .Apply
½Æ»s¥N½X
G¤j¼gªº¾Ú»¡¥u¯à¦Ü3²Õ,©Ò¥H§Ú­×§ï¬°¥H¤U5²Õªº¤èªk´N¦æ¤£³q?
  1. With Workbooks("BCM Order_Format.xlsx")
  2. With .Sheets("PO")
  3.          .Range("A1").CurrentRegion.Sort Key1:=.Range("D2"), Order1:=xlAscending,
  4.           Key2:=.Range("Z2"), Order2:=xlAscending, _
  5.           Key3:=.Range("H2"), Order3:=xlAscending, _
  6.           Key4:=.Range("G2"), Order4:=xlAscending, _
  7.           Key5:=.Range("E2"), Order5:=xlAscending, _
  8.         Header:=xlYes, OrderCustom:=1, MatchCase:=False, Orientation:= xlTopToBottom, SortMethod:=xlStroke, _
  9.         DataOption1:=xlSortNormal, _
  10.         DataOption2:=xlSortNormal, _
  11.         DataOption3:=xlSortNormal, _
  12.         DataOption4:=xlSortNormal, _
  13.         DataOption5:=xlSortNormal
  14.     End With
  15.     End With
½Æ»s¥N½X
½Ð°Ý¨Ì§Ú·Q­nªº,ÁÙ¦³¤°»ò¤èªk¥i¥H¥Î?

TOP

¦^´_ 10# PJChen
2010ª©¥»¬O¥i¥H¦hÁä±Æ§Ç¡A§A©Ò¿ýªºµ{¦¡½X§Y¥i
­Y­n¥H2003±Æ§Ç­­¨î¡A¥i§Q¥Î±Æ§ÇÄæ¦ì¶¶§Ç¡A¨Ï¥Î°j°é¥h±Æ¦C§Y¥i¡A¦ý³o­n§A»¡©úÄæ¦ì¶¶§Ç
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 9# register313

­ì¨Ó¦p¦¹,½Ð°ÝÁÙ¦³¤°»òµ{¦¡¼gªk,¤ñ¸û²Å¦X§Ú©Ò­nªº?¤£­n«ü©w¦C¦¬,¥u­nÄæ¦ì½d³ò,¥B¥i¦³5²Õ¥H¤W±Æ§Çªº?
¤£­nRange("A1:K36") ªº¼gªk,¦³¨S¦³¥t¤@ºØ,¨Ò¦p:  A:K

TOP

¦^´_ 8# PJChen

.Range("A1").CurrentRegion.Sort Key1:=.Range("D2"), Order1:=xlAscending, _

¨Ï¥Îexcel¤º«Ø¤§±Æ§Ç¥\¯à,±Æ§ÇÁä¦Ü¦h3²Õ
±Æ§ÇÁ䦳3²Õ¥H¤W,­n¥Î¨ä¥L¤èªk

TOP

¦^´_ 6# GBKEE

§Ú¤S¨Ó¤F,±Ï©R!½ÐÀ°§Ú¬Ý¤@¤U!
§Ú¦³¦h­Ó¤u§@ªí­n¥Î¨ìsort,­è¤~§A¼gªº±Æ§Çµ{¦¡¦nªø,¦]¬°©Èº|¤F¬Y¬q¦r,©Ò¥H§ÚÀ°¥¦§@¤F¤À¬q,¥i¬O¥¦§¹¥þ¤£°_§@¥Î
         .Range("A1").CurrentRegion.Sort Key1:=.Range("D2"), Order1:=xlAscending,
          Key2:=.Range("Z2"), Order2:=xlAscending, _
          Key3:=.Range("H2"), Order3:=xlAscending, _
          Key4:=.Range("G2"), Order4:=xlAscending, _
          Key5:=.Range("E2"), Order5:=xlAscending, _
        Header:=xlYes, OrderCustom:=1, MatchCase:=False, Orientation:= xlTopToBottom, SortMethod:=xlStroke, _
        DataOption1:=xlSortNormal, _
        DataOption2:=xlSortNormal, _
        DataOption3:=xlSortNormal, _
        DataOption4:=xlSortNormal, _
        DataOption5:=xlSortNormal

TOP

¦^´_ 6# GBKEE

¯u¬O¤Ó·PÁ¤F!§Ú³ßÅw³o­Ó.

TOP

¦^´_ 5# PJChen
.Range("A1:K36")  -> .Range("A1").CurrentRegion  ´N¹³ ±µÀs ¤@ª½ÂX¥R³s±µ¦³¸ê®ÆªºÄæ¤Î¦C
CurrentRegion ÄÝ©Ê   ¶Ç¦^ Range ª«¥ó¡A¸Óª«¥ó¥Nªí¥Ø«eªº°Ï°ì¡C¥Ø«e°Ï°ì¬O«ü¥H¥ô·NªÅ¥Õ¦C¤ÎªÅ¥ÕÄ檺²Õ¦X¬°Ãä¬Éªº½d³ò

TOP

¦^´_ 4# GBKEE
G¤j,
·Q½Ð°Ý.Range("A1:K36") ªº¼gªk,¦³¨S¦³¥t¤@ºØ,¨Ò¦p:  A:K (§Ú¥u¬Oªí¹F·§©À,µ{¦¡½X§Ú¤£·|¼g)
¦]¬°¸ê®Æ·|¤£Â_¼W¥[,¥Î.Range("A1:K36") ¹ï§Ú¨Ó»¡¤£¬O¨º»ò²z·Q.

TOP

¦^´_ 3# PJChen
¸Õ¬Ý¬Ý 2003ªº±Æ§Ç¤è¦¡
  1.     With Windows("Pre-paid_HK Cost.xlsx").Worksheets("NONE NE")
  2.         .Range("A1:K36").Sort Key1:=.Range("A2"), Order1:=xlAscending, Key2:=.Range( _
  3.         "E2"), Order2:=xlAscending, Key3:=.Range("D2"), Order3:=xlAscending, _
  4.         Header:=xlYes, OrderCustom:=1, MatchCase:=False, Orientation:= _
  5.         xlTopToBottom, SortMethod:=xlStroke, DataOption1:=xlSortNormal, _
  6.         DataOption2:=xlSortNormal, DataOption3:=xlSortNormal
  7.     End With
½Æ»s¥N½X

TOP

¦^´_ 2# GBKEE

Gª©¤j,
³Â·Ð§A¤F. VBA TEST 2.zip (27.77 KB)

TOP

        ÀR«ä¦Û¦b : ½_ÁJµ²±o¶V¹¡º¡¡A¶V·|©¹¤U««¡A¤@­Ó¤H¶V¦³¦¨´N¡A´N­n¶V¦³Á¾¨Rªº¯ÝÃÌ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD