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

[µo°Ý] Àˬd­«½Æ©Ê½èªº¸ê®Æ

¥»©«³Ì«á¥Ñ c_c_lai ©ó 2013-7-25 10:02 ½s¿è

¦^´_ 20# GBKEE
±z¥Ø«e¬Ý¨ìªº E ©ÎªÌ¬O E As Variant ³£¤w¦h¤è´ú¸Õ¹L¡A
·í®É E ¬°¦ó­×§ï¦¨ ©ú½T«Å§i¥ç¬O¦¹¥Ñ¨Ó¡C
¥Ø«e¥uµ¥«Ý jackyliu ªº´ú¸Õµ²ªG¤F¡A
§Ú·Q·¥¦³¥i¯à¯uªº¬O Assign ªº°ÝÃD¡A
¦]¬°°ÝÃDµo¥Í®É§Ú¦³Ãö¬d¨ì
  1.         For Each E In Dk.KEYS
  2.             '  E ¶Ç¤J­È¬° "µL"¡A ¥H­Pµo¥Í¥H¤U©µ¥Íªº "«¬ºA¤£²Å" ¿ù»~°T®§
  3.             .Cells(cts, "A").Resize(1, UBound(Dk(E), 2)).Value = Dk(E)   '  Åª¨ú¦r¨åª«¥óªº ITEM (°}¦C)
½Æ»s¥N½X

TOP

¦^´_ 20# GBKEE
²×©ó§ä¨ì°ÝÃD¼xµ²ÂI¤F¡C ·í°õ¦æ§¹«á
  1. For Each E In Sheet1.Range("A1").CurrentRegion.Rows
  2.     D(E.Cells(1, 1) & E.Cells(1, 2) & E.Cells(1, 3) & E.Cells(1, 5)) = E.Value
  3. Next
½Æ»s¥N½X
D.KEYS °}¦C­È¤º®eÀ³¸Ó¦@¦³¤»­Ó¡A§Y¡G
  1. '  D.KEYS :  : Variant/Variant(0 to 5) : ThisWorkbook.ex
  2. '  D.KEYS(0) : "©m¦W¦a°Ï©Ê§O±B«Ã" : Variant/String : ThisWorkbook.ex
  3. '  D.KEYS(1) : "¤p§õ¥x¥_¤k¤w±B" : Variant/String : ThisWorkbook.ex
  4. '  D.KEYS(2) : "¤p¼B®ç¶é¨k¤w±B" : Variant/String : ThisWorkbook.ex
  5. '  D.KEYS(3) : "¤p³¯·s¦Ë¤k¥¼±B" : Variant/String : ThisWorkbook.ex
  6. '  D.KEYS(4) : "¤p±i¤¤Ãc¤k¥¼±B" : Variant/String : ThisWorkbook.ex
  7. '  D.KEYS(5) : "¤p´ö¥x¤¤¨k¤w±B " : Variant/String : ThisWorkbook.ex
½Æ»s¥N½X
¦¹®É¡A«h°õ¦æ¤@¤Á¶¶§Q¡C ¤Ï¤§¡A·í³B²z°}¦Cµ²ªG¬°¤U¦C±¡ªp®É¡G
  1. '  D.KEYS :  : Variant/Variant(0 to 8) : ThisWorkbook.ex
  2. '  D.KEYS(0) : "©m¦W¦a°Ï©Ê§O±B«Ã" : Variant/String : ThisWorkbook.ex
  3. '  D.KEYS(1) : "¤p§õ¥x¥_¤k¤w±B" : Variant/String : ThisWorkbook.ex
  4. '  D.KEYS(2) : "¤p¼B®ç¶é¨k¤w±B" : Variant/String : ThisWorkbook.ex
  5. '  D.KEYS(3) : 0 : Variant/Integer : ThisWorkbook.ex
  6. '  D.KEYS(4) : 1 : Variant/Integer : ThisWorkbook.ex
  7. '  D.KEYS(5) : 2 : Variant/Integer : ThisWorkbook.ex
  8. '  D.KEYS(6) : "¤p³¯·s¦Ë¤k¥¼±B" : Variant/String : ThisWorkbook.ex
  9. '  D.KEYS(7) : "¤p±i¤¤Ãc¤k¥¼±B" : Variant/String : ThisWorkbook.ex
  10. '  D.KEYS(8) : "¤p´ö¥x¤¤¨k¤w±B " : Variant/String : ThisWorkbook.ex
½Æ»s¥N½X
¤W«Ò¡B¦ò¯ª°Ú¡I
·í³ò°é°õ¦æ¨ì D.KEYS(3)¡BD.KEYS(4)¡BD.KEYS(5) ´N¤¤¼Ö³z¤F¡C
³oªí¥Ü¦b
  1. For Each E In Sheet1.Range("A1").CurrentRegion.Rows
  2.     D(E.Cells(1, 1) & E.Cells(1, 2) & E.Cells(1, 3) & E.Cells(1, 5)) = E.Value
  3. Next
½Æ»s¥N½X
³B¸Ì¶¥¬q¥X¤F°ÝÃD¡C À³¸Ó±N­«½Æ­È¤©¥H¹LÂo½Õ¡C

TOP

­«½Æ­È¤©¥H¹LÂo½Õ,©M§Ú»¡ªº­«½Æ­È,¤£­n½Æ»s¨ì Sheet2 ªº·N«ä¶Ü?
¦³¸Ñ¶Ü?

TOP

¦^´_ 20# GBKEE
¦^´_ 23# jackyliu
  1. Option Explicit

  2. Sub ex()
  3.     Dim D As Object, E As Variant, cts As Integer
  4.    
  5.     Set D = CreateObject("Scripting.dictionary")         '  ¦r¨åª«¥ó
  6.    
  7.     For Each E In Sheet1.Range("A1").CurrentRegion.Rows  '  ª«¥ó: A1 ©Ò©µ¦ù½d³òªº¦C
  8.         If D.exists(E.Cells(1, 1) & E.Cells(1, 2) & E.Cells(1, 3) & E.Cells(1, 5)) = False Then _
  9.                D(E.Cells(1, 1) & E.Cells(1, 2) & E.Cells(1, 3) & E.Cells(1, 5)) = E.Value
  10.     Next
  11.    
  12.     With Sheet2
  13.         .Cells.Clear
  14.         cts = 1
  15.         For Each E In D.KEYS
  16.             .Cells(cts, "A").Resize(1, UBound(D(E), 2)).Value = D(E)   '  Åª¨ú¦r¨åª«¥óªº ITEM (°}¦C)
  17.         cts = cts + 1
  18.         Next
  19.     End With

  20.     Set D = Nothing
  21. End Sub
½Æ»s¥N½X
¥[¤J¤F¹LÂo§PÂ_¡AIf D.exists(E.Cells(1, 1) & E.Cells(1, 2) & E.Cells(1, 3) & E.Cells(1, 5)) = False Then ....¡A
jackyliu ½Ð¦A¸Õ¬Ý¬Ý¡I

TOP

¦^´_ 24# c_c_lai
2003ª©¨S¦³ªº°ÝÃD,«ç·|¦b2007ª©¥X²{,ÁÂÁ§AªºÀ°¦£°»¿ù.
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

ªO¤j:
§Ú¬O¥Î2003ª©ªº, ª½±µ«ö°õ¦æOK, °õ¦æ¤T¦¸«á,
§Ú¿ï¾Ü³v¨B°»¿ù,¤@­Ó¤@­Ó¬Ý,  ¤S·|¥X²{¤@¼Ëªº¿ù»~­C!

°õ¦æ¶¥¬q¿ù»~'13'
«¬ºA¤£²Å

«¬ºA¤£²Å.jpg (223.06 KB)

«¬ºA¤£²Å

«¬ºA¤£²Å.jpg

TOP

ªO¤j:
§Ú¬O¥Î2003ª©ªº, ª½±µ«ö°õ¦æOK, °õ¦æ¤T¦¸«á,
§Ú¿ï¾Ü³v¨B°»¿ù,¤@­Ó¤@­Ó¬Ý,  ¤S·|¥X²{¤@¼Ëªº¿ù»~­C!
...
jackyliu µoªí©ó 2013-7-25 21:55

¦pªG¦b«Ø¥ß¤§ªì´N§â µL Âo±¼¬O§_¦³¥i¯à¹F¨ì§Aªº»Ý¨D©O?
  1. .
  2.     For Each E In Sheet1.Range("a1").CurrentRegion.Rows      'ª«¥ó: A1©Ò©µ¦ù½d³òªº¦C
  3.     If Not E.Cells(1, 1) & E.Cells(1, 2) & E.Cells(1, 3) & E.Cells(1, 5) = "" Then
  4.          D(E.Cells(1, 1) & E.Cells(1, 2) & E.Cells(1, 3) & E.Cells(1, 5)) = E.Value
  5.       End If
  6.     Next
½Æ»s¥N½X

TOP

¦^´_ 26# jackyliu
¦A¸Õ¸Õ¬Ý
  1. Option Explicit
  2. Sub Ex()
  3.     Dim D As Object, E, i As Integer
  4.     Set D = CreateObject("Scripting.dictionary")             '¦r¨åª«¥ó
  5.     i = 1
  6.     With Sheet1
  7.         Do While .Cells(i, "A") <> ""
  8.             E = .Cells(i, "A") & .Cells(1, "B") & .Cells(1, "C") & .Cells(1, "E")
  9.             If D.exists(E) = False Then
  10.                D(E) = .Cells(i, "A").Resize(1, 6).Value
  11.             End If
  12.             i = i + 1
  13.         Loop
  14.     End With
  15.     i = 1
  16.     With Sheet2
  17.         .Cells.Clear
  18.         For Each E In D.KEYS
  19.             .Cells(i, "A").Resize(1, UBound(D(E), 2)) = D(E)   'Ū¨ú¦r¨åª«¥óªºITEM(°}¦C)
  20.             i = i + 1
  21.         Next
  22.     End With
  23. End Sub
½Æ»s¥N½X
·P®¦ªº¤ß......(¦b³Â»¶®a±Ú°Q½×°Ï.¥Î¤ß¾Ç²ß·|¦³¶i¨Bªº)
¦ý¸ê·½µL­­,«á´©¦³­­,  ¤@¤Ñ1¤¸ªºÃÙ§U,¤H¤H¦³¯à¤O.

TOP

¥»©«³Ì«á¥Ñ c_c_lai ©ó 2013-7-26 07:33 ½s¿è

¦^´_ 28# GBKEE
¦^´_ 26# jackyliu
¸ÕµÛ±N¥H¤Uµ{¦¡½X­×
  1. For Each E In D.KEYS
  2.     .Cells(cts, "A").Resize(1, UBound(D(E), 2)).Value = D(E)   '  Åª¨ú¦r¨åª«¥óªº ITEM (°}¦C)
  3.     cts = cts + 1
  4. Next
½Æ»s¥N½X
§ï¦¨
  1. For Each E In D.KEYS
  2.     If E <> "" Then _
  3.         .Cells(cts, "A").Resize(1, UBound(D(E), 2)).Value = D(E)   '  Åª¨ú¦r¨åª«¥óªº ITEM (°}¦C)
  4.     cts = cts + 1
  5. Next
½Æ»s¥N½X
¦A±N¥¦¾Þ½m¤@¤U¡C

P.S. ¦^ÂФH®a®É¡A½Ð¨Ï¥Î¿ï«ö "¦^ÂÐ" ¶s¡A§_«h·í¨Æ¤H¬O¤£ª¾¹D©p¤w¦^ÂаÝÃD¤F¡I
       (³o¤]¬O¤@ºØ¶Ç²Î§¸`)

TOP

¦^´_ 29# c_c_lai


    Sorry ~  §Ú¥H¬°¬O¨Ï¥Î ³Ì©³¤Uªº  µoªí¦^´_,
¤U¦¸ª½±µÂI¿ï¤å³¹¸Ìªº¦^ÂÐ ~ ³y¦¨§xÂZ,½Ð¨£½Ì !!

TOP

        ÀR«ä¦Û¦b : ¸Ü¦h¤£¦p¸Ü¤Ö¡A¸Ü¤Ö¤£¦p¸Ü¦n¡C
ªð¦^¦Cªí ¤W¤@¥DÃD