|
楼主 |
发表于 2013-9-24 21:41
|
显示全部楼层
xbxinyu 发表于 2013-9-24 09:31
您好:我想将"加权价单价全部改用基础信息里的单价,在哪改呢
“单据录入”中修改
Private Sub Worksheet_Change(ByVal Target As Range)
Dim ARR, I&
If Not Intersect(Range("G1:G11"), Target) Is Nothing And Range("b2") = "物 资 出 库 单" Then
On Error GoTo 1
With Sheets("数据库")
ARR = .Range("E2:N" & .Range("E65500").End(3).Row)
End With
For I = 1 To UBound(ARR)
If ARR(I, 1) = Target.Offset(0, -4) Then
RS = RS + ARR(I, 5)
CS = CS + ARR(I, 8)
End If
Next
With Sheets("基础信息表")
ARR = .Range("A2:F" & .Range("A65500").End(3).Row)
End With
For I = 1 To UBound(ARR)
If ARR(I, 1) = Target.Offset(0, -4) Then
RS = RS + ARR(I, 5)
RJ = ARR(I, 6)
Exit For
End If
Next
If RS - CS > 0 Then
Target.Offset(, 1) = RJ
End If
If RS - CS - Target < 0 Then MsgBox "本物资库原存数量为: " & RS - CS
End If
1
End Sub
|
|