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

[µo°Ý] ¦p¦ó´M§ä¬Û¦P¸ê®Æ¨Ã½Æ»s¨ä¥LÄæ¦ì

[µo°Ý] ¦p¦ó´M§ä¬Û¦P¸ê®Æ¨Ã½Æ»s¨ä¥LÄæ¦ì

¦U¦ì¦n¡A¥DÃD¥i¯à¦³ÂIªí·N¤£²M
¦ý§Úªº·N«ä¬O·Q­n±NSHEET1¤¤ªºA.B.CÄæ¦ì¸òSHEET2¤ñ¹ï
­YSHEET2Äæ¦ìA.B.C¸ê®Æ¸òSHEET1¬Û²Å«h½Æ»s¸Ó¦CDEF¸ê®Æ¨ìSHEET2
­nª`·Nªº¬O¡ASHEET2ªºµ§¼Æ¥i¯à·|ÅÜ°Ê

¹Á¸Õ¥Îvlookup¼g¹L¦ý¤£ª¾¹D¬O­þ¸Ì¥d¦í¤@ª½³£¼g¤£¥X¨Ó
«á¨Ó¤]¸ÕµÛ¥Î Application.WorksheetFunction.Match ¨Ó¼g¡A¦ý¬O¤p§Ì¥\¤O¤£¨ì¨S¿ìªk±NAÄæ (¤é´Á) ¸òBÄæ(®É¶¡)°µ¤ñ¹ï
¬O§_¦³°ª¤H¥i¥H«üÂI¦p¦ó¤~¯à¹F¨ì§Ú·Q­nªº¥Øªº©O¡H
¦pªG°Ý¿ù°ÝÃD©ÎªÌ«_¥Ç¤F¡AÁٽЦh¦h¥]²[

ªþ¹Ï


¨Ãªþ¤WÀɮרѰѦÒ
comparison.rar (9.27 KB)

¥»©«³Ì«á¥Ñ hugh0620 ©ó 2012-9-30 19:17 ½s¿è

¦^´_ 1# cslinmiso

============================================
¦b¨Ï¥Î®É~ ¥i¯à­n¦Ò¶q¤@¤U¨ç¼Æªº·N¸q»P¤ñ¹ï¸ê®Æªº¤è¦¡~
±zÁ`¦@­n¤ñ¹ï¤T­ÓÄæ¦ìªº¸ê®Æ~ ©Ò¥H~ ¥Îvlookup»Pmatch¤ñ¸û¤£¾A·í~
vlookup¥Î¦b¦P¤@Äæ¶i¦æ¤ñ¹ï~ ¦ý±z¦³¤T­ÓÄæ¦ì­n¤ñ¹ï~~ ¼gªk¤W¤£¹ê¥Î~ ¥B½ÆÂø~
¥i¥H§óª½Ä±ªº¥Îif §PÂ_ abc¤TÄæ¦P¤@¦Cªº¸ê®Æ¬O§_¤@¼Ë~
============================================

­Ó¤Hªº¼gªk¬O·í±z¦bsheet2¤¤¿é¤J¸ê®Æ~
­n§PÂ_
1. ¬O§_¦bcolumn1.2.3¿é¤J¸ê®Æ
2.  column1.2.3¸ê®Æ¬O§_¿é¤J§¹¾ã
3. ³Ì«á±Nsheet2·s¤J¿éªº¸ê®Æ±qsheet1ªº²Ä¤@µ§¸ê®Æ¶}©l¤ñ¹ï~ §ä¸ê®Æ¬O§_¦³»Psheet1¬Û²Åªº~
    ¦pªG¦³´N±N¸ê®Æ§ì¨ú¨ìsheet2

¯ÊÂI: ·ísheet1¤¤¦³­«ÂЪº¸ê®Æ~ ´N·|³QÂл\~

´£¨Ñµ¹±z°Ñ¦Ò~
  1. Private Sub Worksheet_Change(ByVal Target As Range)
  2. A = Target.Column
  3. B = Target.Row
  4. If A > 3 Then Exit Sub

  5. Select Case A
  6. Case 1
  7.      If Target.Offset(0, 1) = "" And Target.Offset(0, 2) = "" Then Exit Sub
  8. Case 2
  9.      If Target.Offset(0, -1) = "" And Target.Offset(0, 1) = "" Then Exit Sub
  10. Case 3
  11.      If Target.Offset(0, -2) = "" Or Target.Offset(0, -1) = "" Then Exit Sub
  12. End Select
  13. I = 0
  14. Do Until Sheet1.Range("A" & 2 + I) = ""
  15.    If Sheet1.Range("A" & 2 + I) = Sheet2.Range("A" & B) And Sheet1.Range("B" & 2 + I) = Sheet2.Range("B" & B) And Sheet1.Range("C" & 2 + I) = Sheet2.Range("C" & B) Then
  16.       Sheet2.Range("D" & B) = Sheet1.Range("D" & 2 + I)
  17.       Sheet2.Range("E" & B) = Sheet1.Range("E" & 2 + I)
  18.       Sheet2.Range("F" & B) = Sheet1.Range("F" & 2 + I)
  19.    End If
  20. I = I + 1
  21. Loop

  22. End Sub
½Æ»s¥N½X
¾Ç²ß¤~¯à´£¤É¦Û¤v

TOP

¥»©«³Ì«á¥Ñ cslinmiso ©ó 2012-9-30 20:44 ½s¿è

¦^´_ 2# hugh0620

ÁÂÁ±zªº¦^À³¡A«D±`·PÁ¡C
¦ý§Ú®M¥Î±zªº¤½¦¡¸Õ°õ¦æ«á¥X²{¿ù»~13 «¬ºA¤£²Å¦X
¬O§_¬°­þ¸Ì¦³¿ù»~©ÎªÌ¤p§Ì­þ¸Ì§Ë¿ù¤F©O¡H
ÁÂÁÂ
  1. Case 1
  2.      If Target.Offset(0, 1) = "" And Target.Offset(0, 2) = "" Then Exit Sub
½Æ»s¥N½X
¬O¦b¦¹µo¥Í¿ù»~ªº¡C
«Ü¦h¨Æ±¡¡A¶}©l°µ¤F¤§«á¤~µo²{«Ü²³æ¡A
¯u¥¿Ãøªº¬O«ç»ò§¹¬ü¦aµo´§¦Û¨­ªºª¬ºA¡C

TOP

¦^´_ 3# cslinmiso

­n¤£­n§â±z°õ¦æ¦³»~ªºÀÉ®×PO¤W¨Ó~ ¬Ý¬Ý°ÝÃD¦b­þ~

­ì¥»§Ú¥H¬°¬Oª©¥»ªº°ÝÃD~  (§Ú¦Û¤v¬O¥Î2003)
«á¨Ó¥Î2007°õ¦æ¤]¨S¦³°ÝÃD~
¾Ç²ß¤~¯à´£¤É¦Û¤v

TOP

¦^´_ 1# cslinmiso
¨Ï¥ÎDictionaryª«¥ó
  1. Option Explicit
  2. Sub Ex()
  3.     Dim d As Object, Rng As Range
  4.     Set d = CreateObject("SCRIPTING.DICTIONARY")  '³]¥ß Dictionaryª«¥ó
  5.     Set Rng = Sheets("sheet1").[a2]
  6.     Do
  7.         d(Format(Rng, "yyyy/m/d") & Format(Rng.Offset(, 1), "hh:mm") & Rng.Offset(, 2)) = Rng.Offset(, 3).Resize(, 3)
  8.         '2012/9/2200:30Aaron        -> Dictionaryª«¥óªº key: Format(Rng, "yyyy/m/d") & Format(Rng.Offset(, 1), "hh:mm") & Rng.Offset(, 2)
  9.         'Rng.Offset(, 3).Resize(, 3)-> Dictionaryª«¥óªº item (D:E:FÄæ)
  10.         Set Rng = Rng.Offset(1)                   'Åܼƪ«¥ó ¤U²¾¤@¦C
  11.     Loop Until Rng.Value = ""                     'Åܼƪ«¥ó¤º®e=ªÅ¥Õ¦r¦êÂ÷¶}°j°é
  12.     Set Rng = Sheets("sheet2").[a2]
  13.     Do
  14.         If d.Exists(Rng.Text & Rng.Offset(, 1).Text & Rng.Offset(, 2)) Then
  15.             'Exists ¤èªk ¦pªG¦b Dictionary ª«¥ó¤¤«ü©wªºÃöÁä¦r¦s¦b¡A¶Ç¦^ True¡A­Y¤£¦s¦b¡A¶Ç¦^ False¡C
  16.             Rng.Offset(, 3).Resize(, 3).Value = d(Rng & Rng.Offset(, 1).Text & Rng.Offset(, 2))
  17.              'D:FÄæ.Value=Dictionaryª«¥óªºitem
  18.         End If
  19.         Set Rng = Rng.Offset(1)
  20.     Loop Until Rng = ""
  21. End Sub
½Æ»s¥N½X

TOP

¦^´_ 3# cslinmiso

®É¶¡¬O§_¤]­n¬Û¦P?
  1. Sub ex()
  2. Dim Mystr$, d As Object, A As Range
  3. Set d = CreateObject("Scripting.Dictionary")
  4. With ¤u§@ªí1
  5. For Each A In .Range(.[A2], .[A2].End(xlDown))
  6.    Mystr = Join(Application.Transpose(Application.Transpose(A.Resize(, 3))), ",")
  7.    d(Mystr) = A.Offset(, 3).Resize(, 3)
  8. Next
  9. End With
  10. With ¤u§@ªí2
  11. For Each A In .Range(.[A2], .[A2].End(xlDown))
  12.    Mystr = Join(Application.Transpose(Application.Transpose(A.Resize(, 3))), ",")
  13.   A.Offset(, 3).Resize(, 3) = d(Mystr)
  14. Next
  15. End With
  16. End Sub
½Æ»s¥N½X
¾Ç®üµL²P_¤£®¢¤U°Ý

TOP

¦^´_ 5# GBKEE
«D±`·PÁÂGBKEEª©¥D¡A¸Õ¥Î«á±o¨ì§Ú·Q­nªºµ²ªG:)
¤p§Ì¤£§÷Áٻݭn¸ò¦U¦ì¦h°Q±Ð
·Q½Ð°Ý¤@­Ó°ÝÃD¡A­Y¤µ¤é»Ý­n¦b¥t¥~¤@¥÷ÀÉ®×·j´M(°²³]¬°Sheet1ªº¸ê®Æ)
¬O§_±N    Set Rng = Sheets("sheet1").[a2] ¦¹¦æ
©w¸q¦¨worksheet.sheet("ÀɦW").[a2] §Y¥i©O?

hugh0620¤j­ô
¤wªþ¤WÀÉ®×
­Y¬O¤p§Ì¾Þ§@¤è­±¿ù»~ÁÙ±o¨£½Ì¡A¦¹¥~·PÁ¤j¤O¨ó§U


comparison.rar (17.51 KB)
«Ü¦h¨Æ±¡¡A¶}©l°µ¤F¤§«á¤~µo²{«Ü²³æ¡A
¯u¥¿Ãøªº¬O«ç»ò§¹¬ü¦aµo´§¦Û¨­ªºª¬ºA¡C

TOP

¦^´_ 6# Hsieh

¬Oªº¡A¤é´Á®É¶¡¦W¦r³£¥²¶·§¹¥þ²Å¦X¤~½Æ»sDEFÄæ¦ìªº¸ê®Æ¦Ü¸ÓÄæ¡C
ÁÂÁ¨ó§U :)
«Ü¦h¨Æ±¡¡A¶}©l°µ¤F¤§«á¤~µo²{«Ü²³æ¡A
¯u¥¿Ãøªº¬O«ç»ò§¹¬ü¦aµo´§¦Û¨­ªºª¬ºA¡C

TOP

Hsieh ª©¥D¡A±zªºµ{¦¡¤]°õ¦æ¦¨¥\
¦ý·§©À¥H¤Îµ{¦¡¥Îªk¤W¡A¤p§Ì©|¦³¤£¸Ñ¡A¥i§_½Ð±z²­z¤@¤U©O¡H
¦P¬O§Q¥ÎDictionaryª«¥ó
±zªºµ{¦¡µw¬O¤Ö¤W³\¦h¡A³o¨ä¤¤¦³¤°»ò®t²§©O¡H
ÁÂÁÂ

PS:¤p§Ì¨Ã«D¦³·Nµo³o»ò¦h¦¸¤å¡A«Y¬°®É¶¡®t¡A¤S·Q¨ì°ÝÃD·Q°Ý¡C½Ð¨£½Ì
«Ü¦h¨Æ±¡¡A¶}©l°µ¤F¤§«á¤~µo²{«Ü²³æ¡A
¯u¥¿Ãøªº¬O«ç»ò§¹¬ü¦aµo´§¦Û¨­ªºª¬ºA¡C

TOP

¦^´_ 7# cslinmiso
"¬O§_±N    Set Rng = Sheets("sheet1").[a2] ¦¹¦æ  ©w¸q¦¨worksheet.sheet("ÀɦW").[a2] §Y¥i©O?"
§A¸Õ¸Õ´Nª¾¹D

TOP

        ÀR«ä¦Û¦b : ­ì½Ì§O¤H´N¬Oµ½«Ý¦Û¤v¡C
ªð¦^¦Cªí ¤W¤@¥DÃD