|
发表于 2016-7-17 22:26
|
显示全部楼层
本楼为最佳答案
得到的数值和你的有点小小出入,请测试:- Sub wanao()
- Dim x As Integer, y As Integer, S1 As Integer, S2 As Integer, jiShu As Integer
- S1 = 14
- S2 = 19
- For x = 2 To 12
- jiShu = 0
- For y = 8 To 3 Step -1
- If Cells(x, y) <> "" Then
- jiShu = jiShu + 1
- Cells(x, S1 - jiShu) = Cells(x, y)
- If jiShu = 1 Then
- Cells(x, S2 - jiShu) = 100
- Else
- Cells(x, S2 - jiShu) = 100 / Cells(x, "m") * Cells(x, S1 - jiShu)
- End If
- End If
- If jiShu = 4 Then
- Cells(x, "t") = Abs(Cells(x, "r") - Cells(x, "q")) + Abs(Cells(x, "q") - Cells(x, "p")) + Abs(Cells(x, "p") - Cells(x, "o"))
- Exit For
- End If
- Next
- Next
- End Sub
复制代码 |
|