- ©«¤l
- 2836
- ¥DÃD
- 10
- ºëµØ
- 0
- ¿n¤À
- 2892
- ÂI¦W
- 0
- §@·~¨t²Î
- ¡e²¤¡f
- ³nÅ骩¥»
- ¡e²¤¡f
- ¾\ŪÅv
- 100
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ¡e²¤¡f
- µù¥U®É¶¡
- 2013-5-13
- ³Ì«áµn¿ý
- 2024-11-30
|
¦^´_ 3# jesscc
Sub test()
Dim Arr, Brr, xD, R&, i&, N&, T$, TY$, TR, xE As Range
Set xD = CreateObject("scripting.dictionary")
R = Sheets("B area").[G5000].End(xlUp).Row
Arr = Sheets("B area").Range("A7:X" & R)
ReDim Brr(1 To R, 1 To 9)
For i = 1 To UBound(Arr)
T = Arr(i, 19): R = xD(T): If T = "" Then GoTo 101
TY = Arr(i, 14) & "*" & Format(Arr(i, 7), "#,##0") & "pcs" '®Æ¸¹*¥X³f¼Æ ¤å¦r¦ê, ¥i±N*§ï¬°ªÅ®æ
If R = 0 Then
N = N + 1: xD(T) = N: R = N
'Brr(N, 1) = N '§Ç¸¹
Brr(N, 2) = "PKG"
Brr(N, 3) = Arr(i, 17) '¥ó¼Æ
Brr(N, 6) = Arr(i, 22) / Arr(i, 17) 'Unit Price (US$)
Brr(N, 7) = Arr(i, 22) 'Amount (US$)
End If
'Brr(R, 5) = Val(Brr(R, 5)) + Val(Arr(i, 7)) '¥X³f¼Æ(²Öp)
'Brr(R, 8) = Val(Brr(R, 8)) + Val(Arr(i, 8)) '²b«(²Öp)
'Brr(R, 9) = Val(Brr(R, 9)) + Val(Arr(i, 9)) '¤ò«(²Öp)
'------------------------------------
T = Replace(Replace(Brr(R, 4), "//", "("), ")", "") '¨ú±oì¤ÀÃþ¤å¦r
If T = "" Then Brr(R, 4) = Arr(i, 14) & "//" & TY: GoTo 101
TR = Split(T, "(") '©î¸Ñì¤ÀÃþ¤å¦r
Brr(R, 4) = Trim(TR(0)) & " ( " & Trim(TR(1)) & ", " & TY & " )" '¤ÀÃþ(¥[µù)
101: Next i
If N = 0 Then Exit Sub
Set xE = Sheets("INVOICE").[D65536].End(xlUp)(2, 0)
With xE.Resize(N, 9)
.Value = Brr
.Columns(4).Replace "//*", "", Lookat:=xlPart 'Y¬°³æµ§, ²M°£«á±ªº¥[µù¤å¦r
.Columns(4).WrapText = True '¦Û°Ê´«¦C
.Columns(4).EntireRow.AutoFit '¦Û°Ê¦C°ª
.Borders.LineStyle = 1 '®Ø½u
Application.Goto .Item(1) '¸õ¦ÜINVOICE¤u§@ªí
End With
End Sub
======================== |
|