Dim i As Byte
Dim j As Byte
Dim Row3 As Byte
Dim sum As Single
Dim Less(22) As Single For j = 1 To 22
For i = Row3 - 7 To Row3
sum = sum + CSng(Worksheets("低点偏差表").Cells(i, j).Value)
Less(j - 1) = sum / 7
Worksheets("低点修正表").Cells(i, j).Value = Worksheets("低点实测表").Cells(i, j).Value + Less(j - 1)
Next i
Next j运行时显示这句Worksheets("低点修正表").Cells(i, j).Value = Worksheets("低点实测表").Cells(i, j).Value + Less(j - 1)
类型不匹配,还望高手指点~~~多谢多谢了
Dim j As Byte
Dim Row3 As Byte
Dim sum As Single
Dim Less(22) As Single For j = 1 To 22
For i = Row3 - 7 To Row3
sum = sum + CSng(Worksheets("低点偏差表").Cells(i, j).Value)
Less(j - 1) = sum / 7
Worksheets("低点修正表").Cells(i, j).Value = Worksheets("低点实测表").Cells(i, j).Value + Less(j - 1)
Next i
Next j运行时显示这句Worksheets("低点修正表").Cells(i, j).Value = Worksheets("低点实测表").Cells(i, j).Value + Less(j - 1)
类型不匹配,还望高手指点~~~多谢多谢了
同意jhone的看法,应该是某一行的Worksheets("低点实测表").Cells(i, j).Value含有非数值值,比如文本。另外,一个提醒,你的数组是Base 0的还是Base 1的,有些时候出现莫名其妙的错误是由于数组下标的基不同而导致的。不过就当前这个问题来说,不会是数组的Base引起的,不然的话应该在Less(j - 1) = sum / 7处就报错。