|
本帖最后由 香格里拉 于 2011-12-24 23:12 编辑
前一段时间我在论坛里说过现在比较忙,主要是在负责生产大型的F3和PEEK等产品,直径都在1米以上的圈,没时间上论坛,请大家原谅.目前生产人员对大型件的生产工艺已较成熟,原来想和大家多交流一下,可老板决定把我从生产技术部门调到纯管理部门.现正在起草大量的管理文件.表格和校对及考核用的VBA程序.每天还是忙得团团转,经常是到半夜才休息.在此再次对大家说声对不起,感谢论坛上所有关心和支持我的朋友.在此祝大家圣诞节快乐!
最后附上一段简单的VBA程序,给懂行的参考
Sub 混料库存情况汇总()
Dim L, M, N, F, H, Q As Double
Dim SZ(4 To 300) As String
A$ = 1: W = 3: B$ = 1: T = 3: O = 3: D$ = 1
Do While A$ <> "" Or D$ <> ""
W = W + 1: A$ = Cells(W, 3): D$ = Cells(W, 2)
Loop
I = 4: A$ = 1
AT = I: GoSub AD
For I = 4 To W - 1
A$ = Cells(I, 3): D$ = Cells(I, 2)
If A$ = "" Then GoTo C
For C = 4 To I
If A$ = SZ(C) Then GoTo C
If A$ = "" And D$ = "" Then GoTo P
Next
L = Cells(I, 4): V = Cells(I, 5): M = Cells(I, 7): G = L + M - V
For J = I + 1 To W - 1
B$ = Cells(J, 3)
If (A$ = B$) Then
F = Cells(J, 4): U = Cells(J, 5): H = Cells(J, 7)
L = L + F: V = V + U: M = M + H: G = L + M - V
If J = W - 1 Then GoTo B
End If
Next
B:
For Y = 4 To 300
If A$ = SZ(Y) Then GoTo C
Next
T = T + 1: O = O + 1
Worksheets("成本核算 (2)").Cells(T, 3) = A$: SZ(O) = A$
Worksheets("成本核算 (2)").Cells(T, 4) = L: Worksheets("成本核算 (2)").Cells(T, 5) = V
Worksheets("成本核算 (2)").Cells(T, 7) = M: Worksheets("成本核算 (2)").Cells(T, 6) = G
C:
Next
Title = "浙江嘉日氟塑有限公司混料库存情况汇总"
MsgBox "恭喜你混料库存情况汇总程序执行完毕,你很聪明!本程序由吴强先生编制", vbOKOnly, Title
GoTo S
P:
Title = "对不起原料名称栏目前没有数据!"
MsgBox "对不起本程序无法运行,请输入原料名称后重新运行本程序!", vbOKOnly, Title
GoTo S
AD:
For I = 4 To W - 1
A$ = Cells(I, 3): D$ = Cells(I, 2)
If A$ = "" And D$ = "" Then GoTo AB
For C = 4 To I
If A$ = "" And D$ = "" Then GoTo P
Next
L = Cells(I, 4): V = Cells(I, 5): M = Cells(I, 7): G = L + M - V
For J = I + 1 To W - 1
B$ = Cells(J, 2)
If (D$ = B$) Then
F = Cells(J, 4): U = Cells(J, 5): H = Cells(J, 7)
L = L + F: V = V + U: M = M + H: G = L + M - V
If J = W - 1 Then GoTo F
End If
Next
F:
If D$ = "" Then GoTo AB
T = T + 1: O = O + 1
Worksheets("成本核算 (2)").Cells(T, 2) = D$: SZ(O) = D$
Worksheets("成本核算 (2)").Cells(T, 4) = L: Worksheets("成本核算 (2)").Cells(T, 5) = V
Worksheets("成本核算 (2)").Cells(T, 7) = M: Worksheets("成本核算 (2)").Cells(T, 6) = G
AB:
Next
I = AD: Return
S:
End Sub
|
|