|
楼主 |
发表于 2024-1-14 12:05
|
显示全部楼层
感谢四楼的帮助,学艺不精,还在VBA门口,未踏进门,略懂点,又不太懂……再次感谢四楼,鲜花已奉献上,我也作了小小修改,改成工作表触动单元格运行……他是雷锋,你落进下石,你是大神,不能和我这种才刚学不久的小白计较,你看看就好……
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Row >= 8 And Target.Column = 7 Or Target.Column = 8 Then
With Sheets("送货单")
Range("I8:I18").Value = 0
arr = Range("A7:I18").Value
For i = 2 To UBound(arr)
If arr(i, 6) <> Empty Then
If InStr(arr(1, 8), "克工价") Then
arr(i, 9) = arr(i, 6) * arr(i, 7) + arr(i, 5) * arr(i, 8)
Else
arr(i, 9) = arr(i, 6) * (arr(i, 7) + arr(i, 8))
End If
End If
Next
Range("a7:i18").Value = arr
End With
End If
End Sub
|
|