For i = 45 To [L46].End(1).Row 谁能帮我解释下具体程序如下:Sub Macro9() Sheets("PP&BS(按胶系)").Select On Error Resume NextDim i, j, cFor i = 45 To [L46].End(1).Row c = Cells(i, 256).End(1).Column Cells(i, 5) = "" Cells(i, 6) = ""

来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/22 11:13:47
Fori=45To[L46].End(1).Row谁能帮我解释下具体程序如下:SubMacro9()Sheets("PP&BS(按胶系)").SelectOnErrorResumeNextDimi,j

For i = 45 To [L46].End(1).Row 谁能帮我解释下具体程序如下:Sub Macro9() Sheets("PP&BS(按胶系)").Select On Error Resume NextDim i, j, cFor i = 45 To [L46].End(1).Row c = Cells(i, 256).End(1).Column Cells(i, 5) = "" Cells(i, 6) = ""
For i = 45 To [L46].End(1).Row 谁能帮我解释下
具体程序如下:
Sub Macro9()
Sheets("PP&BS(按胶系)").Select
On Error Resume Next
Dim i, j, c
For i = 45 To [L46].End(1).Row
c = Cells(i, 256).End(1).Column
Cells(i, 5) = ""
Cells(i, 6) = ""
Cells(i, 7) = ""
Cells(i, 8) = ""
Cells(i, 9) = ""
Cells(i, 10) = ""
XX = 0
YY = 0
ZZ = 0
CC = 0
BB = 0
For j = 12 To c Step 6
Cells(i, 5) = Cells(i, 5) + Cells(i, j)
Cells(i, 6) = Cells(i, 6) + Cells(i, j + 1)
XX = XX + Cells(i, j) * Cells(i, j + 2)
YY = YY + Cells(i, j) * Cells(i, j + 3)
ZZ = ZZ + Cells(i, j + 1) * Cells(i, j + 4)
CC = CC + Cells(i, j + 1) * Cells(i, j + 5)
BB = BB + Cells(i, j + 1) * Cells(i, j + 6)
Cells(i, 7) = XX / Cells(i, 5)
Cells(i, 8) = YY / Cells(i, 5)
Cells(i, 9) = ZZ / Cells(i, 6)
Cells(i, 10) = CC / Cells(i, 6)
Next
Next
End Sub

For i = 45 To [L46].End(1).Row 谁能帮我解释下具体程序如下:Sub Macro9() Sheets("PP&BS(按胶系)").Select On Error Resume NextDim i, j, cFor i = 45 To [L46].End(1).Row c = Cells(i, 256).End(1).Column Cells(i, 5) = "" Cells(i, 6) = ""
看帮助Range.End 属性
End 属性适用于Range 对象描述返回 Range 对象,该对象代表包含源区域的区域结尾处的单元格.等同于按键 END+上箭头键、END+下箭头键、END+左箭头键或 END+右箭头键.只读.句法expression.End(Direction)expression必选.该表达式返回 Range 对象.DirectionLong 类型,必选.移动的方向.可为下列 XlDirection 常量之一:xlToLeft,xlToRight,xlUp或xlDown.
所以,1 就是 xlToLeft.