- ©«¤l
- 1446
- ¥DÃD
- 40
- ºëµØ
- 0
- ¿n¤À
- 1470
- ÂI¦W
- 0
- §@·~¨t²Î
- Windows 7
- ³nÅ骩¥»
- Excel 2010 & 2016
- ¾\ŪÅv
- 50
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW
- µù¥U®É¶¡
- 2020-7-15
- ³Ì«áµn¿ý
- 2024-10-21
|
ÁÂÁ½׾Â,ÁÂÁ¦U¦ì«e½ú
«á¾ÇÂǦ¹©«¾Ç²ß¥H«e½úªº¤è®×§ï¦¨¤@Ó°}¦C³B²zªº¤è®×,¾Ç²ß¤è®×¦p¤U,½Ð¦U¦ì«e½ú«ü±Ð
Sub TEST()
Dim Brr, Y, i&, Sh1 As Worksheet, Sh2 As Worksheet
'¡ô«Å§iÅܼÆ
Set Y = CreateObject("Scripting.Dictionary")
'¡ô¥OYÅܼƬO ¦r¨å
Set Sh1 = Sheets("day1"): Set Sh2 = Sheets("day2")
'¡ô¥OSh1ÅܼƬO ¦W¬° "day1"ªº¤u§@ªí,¥OSh2ÅܼƬO ¦W¬° "day2"ªº¤u§@ªí
Brr = Range(Sh1.[Q1], Sh1.[A65536].End(3))
'¡ô¥OBrrÅܼƬO ¤Gºû°}¦C,¥HSh1¤u§@ªíA~QÄæÀx¦s®æȱa¤J°}¦C¤¤
For i = 2 To UBound(Brr)
'¡ô³]¶¶°j°é
Y(Brr(i, 2) & Brr(i, 5) & Brr(i, 14) & Brr(i, 15)) = Val(Brr(i, 8))
'¡ô¥O²Ä(2,5,14,15)Äæ°}¦CȲզ¨ªº·s¦r¦ê·íkey,item¬O ²Ä8Äæ°}¦CÈÂà¼ÆÈ
Next
Brr = Range(Sh2.[Q2], Sh2.[A65536].End(3))
'¡ô¥OBrr°}¦C´«¸Ë Sh1¤u§@ªíA~QÄæÀx¦s®æÈ(¤£§t¼ÐÃD¦C)
For i = 1 To UBound(Brr)
'¡ô³]¶¶°j°é
Brr(i, 1) = Val(Y(Brr(i, 2) & Brr(i, 5) & Brr(i, 14) & Brr(i, 15)))
'¡ô¥OBrr²Ä1Äæ°j°é°}¦CȬO ¥H²Ä(2,5,14,15)Äæ°}¦CȲզ¨ªº·s¦r¦ê,¬d
'¬dY¦r¨å¦^¶ÇitemÈÂà¼ÆÈ(¥Hµ²ªGÈÂл\ì°}¦CÈ)
If Val(Brr(i, 8)) > Brr(i, 1) Then Brr(i, 2) = "¼W¥[" Else Brr(i, 2) = ""
'¡ô¦pªG²Ä8ÄæBrr°j°é°}¦CÈÂà¼ÆÈ ¤j©ó Brr²Ä1Äæ°}¦CÈ,
'´N¥OBrr²Ä2Äæ°}¦CÈ¥H "¼W¥["¦r¦ê ¼g¤J,§_«h´NÅýªÅ¥Õ
Next
Sh2.[R2].Resize(UBound(Brr), 2) = Brr: Sh2.[R1:S1] = [{"¬Q¤é","®t²§"}]
'¡ô¥OBrr°}¦CȱqSh2ªí[R2]¼g¤JÀx¦s®æ¤¤,¥O[R1:S1]¼g¤J¦C¼ÐÃD
Set Y = Nothing: Set Sh1 = Nothing: Set Sh2 = Nothing: Erase Brr
'¡ô¥OÄÀ©ñÅܼÆ
End Sub |
|