- ©«¤l
- 5923
- ¥DÃD
- 13
- ºëµØ
- 1
- ¿n¤À
- 5986
- ÂI¦W
- 0
- §@·~¨t²Î
- win10
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 150
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¥xÆW°ò¶©
- µù¥U®É¶¡
- 2010-5-1
- ³Ì«áµn¿ý
- 2022-1-23
|
¦^´_ 21# li_hsien
¸Õ¸Õ¬Ý
9#©Ò»¡: ³Ì«áµ²ªG¬O"²£«~"¸ò"ª«®Æ"ªº¶µ¥Ø¼Æ·|¬O¤@¼Ëªº¨S¦³¿ù- Option Explicit
- Sub Ex()
- Dim d As New Collection, AR(), i As Integer, Rng As Range ', e As Variant
- On Error Resume Next 'Collection·s¼WªºKEY¦p³Q¨Ï¥Î©Î¦³¿ù»~
- With Worksheets("²£«~ºÞ±±²M³æ")
- For i = 2 To .Range("J1").End(xlDown).Row
- AR = Application.Transpose(Application.Transpose(.Range("A" & i).Resize(, 10)))
- '****** ²£«~(A:J)Äæ¦ì¸ê®Æ¾É¤J°}¦C ****
- '1:²£«~Äæ¦ì¶g§O ,2'²£«~Äæ:§ó·s¶g§O,3:MP date,4:²£«~Ãþ§O,5:PRODUCT ID,
- '6:CHILDPARTNUMBER,7:CHILD_DESCRIPTION,8:Maker,9:MAKER & CODE.10:ID & PartNumber
- d.Add AR, .Range("J" & i) '
- '*****§ä¥X[²£«~ºÞ±±²M³æ]«½Æªº[ID & PartNumber] ****
- If Err <> 0 Then
- If Rng Is Nothing Then
- Set Rng = .Range("J" & i)
- Else
- Set Rng = Union(.Range("J" & i), Rng)
- End If
- End If
- Err.Clear
- '*****************************************************
- Next
- End With
- On Error GoTo 0 '¤£¦A³B¸Ìµ{¦¡ªº¿ù»~
- If Not Rng Is Nothing Then Rng.EntireRow.Delete
- With Worksheets("ª«®ÆºÞ±±²M³æ")
- .UsedRange.Offset(1).Clear
- For i = 1 To d.Count
- With .Range("A" & i + 1)
- '²£«~Äæ¦ì
- '1:²£«~Äæ¦ì¶g§O ,2'²£«~Äæ:§ó·s¶g§O,3:MP date,4:²£«~Ãþ§O,5:PRODUCT ID,
- '6:CHILDPARTNUMBER,7:CHILD_DESCRIPTION,8:Maker,9:MAKER & CODE.10:ID & PartNumber
- .Range("A1") = d(i)(5) '¾É¤Jª««~Äæ¦ìA1-M1
- .Range("B1") = d(i)(6)
- .Range("C1") = d(i)(7)
- .Range("D1") = d(i)(8)
- .Range("E1") = d(i)(9)
- .Range("F1") = d(i)(10)
- .Range("G1") = Format(d(i)(3), "YYYY/M/D")
- .Range("H1") = d(i)(2)
- .Range("I1") = d(i)(1)
- .Range("M1") = DateDiff("d", Date, .Range("G1")) '¤u§@¤é(M)
- End With
- Next
- End With
- MsgBox d.Count & "¶µ OK"
- End Sub
½Æ»s¥N½X |
|