|
Sub 运费计算()
' https://club.excelhome.net/forum-2-1.html
' 2024-4-25
' 规则:小于等于10KG的,从客户报价表查运费;大于10KG的分二部分:=报价表上12列的值 + 超出部分按13列上的单价计
Sheet1.Select
x1 = 3
Do While Not (IsEmpty(Sheet1.Cells(x1, 1).Value))
c_khmc = Sheet1.Cells(x1, 5).Value
n_cl = Sheet1.Cells(x1, 10).Value
c_sjsf = Sheet1.Cells(x1, 13).Value
If c_khmc = "散户" Then
Sheet1.Cells(x1, 11).Value = "没有报价表"
Else
xx = 0: yy = 0
i = 3
Do While Not (IsEmpty(Sheets(c_khmc).Cells(i, 1).Value))
If Sheets(c_khmc).Cells(i, 1).Value = c_sjsf Then
xx = i ' 在对应的客户表上,依省名定行的位置
End If
i = i + 1
Loop
For j = 2 To 12
If Val(Sheets(c_khmc).Cells(2, j).Value) = n_cl Then
yy = j ' 在对应的客户表上,依重量名定列的位置
End If
Next j
'-----确定报价
If yy > 0 And n_cl < 11 Then
Sheet1.Cells(x1, 11).Value = Sheets(c_khmc).Cells(xx, yy).Value
End If ' 计算价格
If yy = 0 And n_cl > 10 Then
Sheet1.Cells(x1, 11).Value = Sheets(c_khmc).Cells(xx, 12).Value + (Sheet1.Cells(x1, 10).Value - 10) * Sheets(c_khmc).Cells(xx, 13).Value
End If ' 计算价格
End If
x1 = x1 + 1
Loop
End Sub |
评分
-
1
查看全部评分
-
|