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

[µo°Ý] ½Ð°Ý­n¦p¦ó¤Á³Î¼Æ¾Ú¥H¤è«K°µ¹Ï¡H

[µo°Ý] ½Ð°Ý­n¦p¦ó¤Á³Î¼Æ¾Ú¥H¤è«K°µ¹Ï¡H

¦]¬°¤u§@»Ý¨D
©Ò¥H±`±`­n±N¹Ïµe¦¨ sheet2 ªº¼Ë¤l
¦ý¬O±q¸ê®Æ®w§ì¤U¨Óªº data ¬O sheet1 ±Æ¦C¤è¦¡
½Ð°Ý¸Ó«ç»ò°µ¤~¯à§Ö³t±N¸ê®ÆÅܦ¨ sheet2 ªº§Î¦¡¥H¤è«K°µ¹Ï©O¡H

Sheet2 ¬O¥ý¹ï 1. EQ 2. TIME °µ±Æ§Ç
¦A¬Ý EQ ¦³¦h¤Ö group ¦A¨Ì¶¶§Ç¦C¦b TIME ªº«á­±¡A¨Ã±N¦P group ªº¼Æ­È©¹®ÇÃä²¾
¥B®Ú¾Ú»Ý­n¡A¦b group ªº³Ì«á´¡¤J 0~n ªºªÅ¥Õ¦C
¡]¨C­Ó group «á­±´¡¤JªºªÅ¥Õ¦C³£¬O¤@¼Ëªº¡A¤£·|¦³ªº´¡¤J¤@¦C¡A¦³ªº¤£´¡¤J¡^
³Ì«á¦Aµe¥X§é½u¹Ï¡C

¦³®É­Ô group ¤Ó¦h¡A¼Æ¾Ú·|²¾¨ì¶Ã±¼¡A©Ò¥H§Æ±æÂÇ¥Ñ VBA §Ö³t¤S¤£©ö§Ë¿ù¨Ó¹F¦¨»Ý¨D¡C
±Æ§Çªº³¡¥÷§Ú¥i¥H¦Û¤v¤â°Ê±Æ§Ç¡A¦ý¼Æ¾Ú¤Á³Îªº³¡¥÷§Æ±æ¥Ñ VBA ¹F¦¨¡C
½ÐÀ°À°¦£¡AÁÂÁ¡ã

½d¨Ò.zip (16.75 KB)

¥»©«³Ì«á¥Ñ stillfish00 ©ó 2013-12-20 22:01 ½s¿è

¦^´_ 1# Genie
  1. Sub test()
  2.     Dim ar, d, arEQ, i As Long
  3.    
  4.     '½Æ»s¨Ó·½
  5.     With Sheets("Sheet1")
  6.         .AutoFilterMode = False
  7.         .[A1].CurrentRegion.Copy Sheets("Sheet2").[A1]
  8.         .[A1].AutoFilter
  9.     End With
  10.    
  11.     With Sheets("Sheet2")
  12.         '±Æ§Ç
  13.         With .Sort
  14.             .SortFields.Clear
  15.             .SortFields.Add .Parent.Range("B2:B" & Rows.Count), xlSortOnValues, xlAscending
  16.             .SortFields.Add .Parent.Range("C2:C" & Rows.Count), xlSortOnValues, xlAscending
  17.             .SetRange .Parent.[A1].CurrentRegion
  18.             .Header = xlYes
  19.             .Orientation = xlTopToBottom
  20.             .SortMethod = xlPinYin
  21.             .Apply
  22.         End With
  23.         
  24.         '§ä¥X¨C¬q°_©l¦ì¸m
  25.         ar = .[A1].CurrentRegion.Value
  26.         Set d = CreateObject("scripting.dictionary")
  27.         For i = 2 To UBound(ar)
  28.             If ar(i, 2) <> ar(i - 1, 2) Then d(ar(i, 2)) = i
  29.         Next i
  30.         
  31.         '¥Ñ«á©¹«e¤À³Î¡A´¡¤JªÅ¥Õ
  32.         arEQ = d.keys
  33.         For i = UBound(arEQ) To LBound(arEQ) + 1 Step -1
  34.             .Range(.Cells(d(arEQ(i)), "D"), .Cells(.Rows.Count, "D")).Insert xlToRight
  35.             .Rows(d(arEQ(i))).Insert xlDown
  36.         Next i
  37.         .[D1].Resize(, d.Count).Value = d.keys
  38.     End With
  39. End Sub
½Æ»s¥N½X

TOP

¦^´_ 2# stillfish00


¤£¦n·N«ä
§Ú±q "With .Sort" ³o¸Ì´N¶}©l¥X²{¿ù»~
½Ð°Ý¸Ó¦p¦ó­×¥¿¡HÁÙ¬O§Ú­þ¸Ì¦³§Ë¿ù©O¡H
ÁÂÁ¡I

TOP

¦^´_ 3# Genie
¥i¯à§Aªºª©¥»¤ñ¸û¡A»yªk¤£¤ä´©
§â±Æ§Ç¨º¬q´«¦¨
  1.         '±Æ§Ç
  2.         .[A1].CurrentRegion.Sort key1:=.[B1], order1:=xlAscending, key2:=.[C1], order2:=xlAscending, Header:=xlYes, Orientation:=xlTopToBottom
½Æ»s¥N½X
¸Õ¬Ý¬Ý

TOP

¦^´_ 4# stillfish00


±Æ§Çªº³¡¥÷¨S¦³¥X²{¿ù»~°T®§¤F
¦ý¤U¤@¨B¤S¸õ¥X error "ar = .[A1].CurrentRegion.Value"
³o¸Ì¸Ó«ç»ò­×§ï©O¡H

§Ú Excel ªºª©¥»¬O 2003
³o¤]¬Oª©¥»®t²§ªº°ÝÃD¶Ü¡H
ÁÂÁ¡I

TOP

¦^´_ 5# Genie
¥i¯à§a...§Ú¨S¿ìªk´ú¸Õª©¥»
¼gªk«Ü¦hºØ¡A¦Û¤v¸Õ¸Õ§a
ar = Range(.[A1],.[A1].end(xldown)).resize(,4).Value

TOP

¦^´_ 6# stillfish00


ÁÙ¬O¤£¦æ

¦]¬°¤½¥q¥u¯à¨Ï¥Î 2003 ª©
¥i¯à»yªk¤£¤ä´©
©Ò¥H·|¤@ª½¥X²{¿ù»~§a¡K¡K

TOP

        ÀR«ä¦Û¦b : ¯à·F¤£·F¡A¤£¦p­W·F¹ê·F¡C
ªð¦^¦Cªí ¤W¤@¥DÃD