实例图如下:
代码如下:
Sub july232()
For Each y In Worksheets
x = y.UsedRange.Rows.Count
For i = 2 To x
x = y.Cells(i, "B")
a = y.Cells(i, "A")
c = y.Cells(i, "C")
If x <= 3 Then
c = a - a * 0.01
ElseIf x <= 5 Then
c = a - a * 0.02
Else
c = a - a * 0.05
End If
Next
Next
End Sub