¤w¸gªñ¤@Ó¬P´Á¤F¡A§Ú²ª½n³Q³oÓ "°õ¦æ¶¥¬q¿ù»~13"·d±o§ÖºÆ¤F¡A¤@ª½¤£Â_¦aקïµ{¦¡½X¡A¦ý¬O¿ù»~¤@ª½¤£«È®ð¦a¥X²{¡A½Ð¦U¦ì±Ï±Ï§Ú§a!
¥H¤U¬Oµ{¦¡½X¡A¬õ¦r¬O¥X²{°»¿ùªº³¡¤À¡AªþÀɸ̥t¦³¸Ô²Ó»¡©ú
Sub C_MERGE()
If [T7] = "" Then Exit Sub
[X7:AG100].ClearContents
Dim cRow&, T As Range
Set d = CreateObject("Scripting.Dictionary") '¤¤¤å«~¶µ¦X¨Ö
For Each T In Range([T7], [T300].End(xlUp))
If d(T.Value) = "" Then '¦pªGTÄæ¸ê®Æ¥u¦³¤@µ§¤£«½Æ
d(T.Value) = T.Offset(, -6) & " " & T.Offset(, -4) & " " & T.Offset(, -3)
Else
d(T.Value) = d(T.Value) & ", " & T.Offset(, -6) & " " & T.Offset(, -4) & " " & T.Offset(, -3)
End If
Next
[Y7].Resize(d.Count, 1) = Application.Transpose(d.keys)
[AF7].Resize(d.Count, 1) = Application.Transpose(d.items)
Set d = Nothing
'--------------------------
Set d1 = CreateObject("Scripting.Dictionary") '^¤å«~¶µ¦X¨Ö
For Each T In Range([T7], [T300].End(xlUp))
If T.Offset(, 2) = "" Then GoTo AA
If d1(T.Value) = "" Then
d1(T.Value) = T.Offset(, -5) & " " & T.Offset(, 2) & " " & T.Offset(, -3)
Else
d1(T.Value) = d1(T.Value) & ", " & T.Offset(, -5) & " " & T.Offset(, 2) & " " & T.Offset(, -3)
End If
AA: Next
[AG7].Resize(d1.Count, 1) = Application.Transpose(d1.items)
Set d1 = Nothing
cRow = Range("Y100").End(xlUp).Row
If cRow < 7 Then Exit Sub
Range("X7:X" & cRow).Formula = "=VLOOKUP(Y7,T:U,2,FALSE)"
Range("Z7:Z" & cRow).Formula = "=COUNTIF(T$7:T$490,Y7)"
Range("AA7:AA" & cRow).Formula = "=SUMIF(T$7:T$490,Y7,S$7:S$490)"
Range("AB7:AB" & cRow).Formula = "=ROUND(AA7/$AC$5*$AC$4,0)"
Range("AC7:AC" & cRow).Formula = "=SUMIF(T$7:T$390,Y7,R$7:R$390)"
Range("AD7:AD" & cRow).Formula = "=IF(AE7=""TOOLING"",AC7+Z7*10,AC7+Z7*2)"
End Sub
test.rar (24.77 KB)
|