我的程式码如下:
Dim i, j, n, m As Integer
Dim V5, V10, V20, V60, V120, V240 As Double
Dim R5, R10, R20, R60, R120, R240 As Range
n = Sheets("成交量").Cells(Rows.Count, 3).End(xlUp).Row
m = Sheets("成交量").Cells(11, Columns.Count).End(xlToLeft).Column
For i = 12 To n
Sheets("得分").Cells(i, 1) = Sheets("成交量").Cells(i, 1)
Sheets("得分").Cells(i, 2) = Sheets("成交量").Cells(i, 2)
Sheets("得分").Cells(i, 3) = Sheets("成交量").Cells(i, 3)
V = Sheets("成交量").Cells(i, m)
Set R5 = Sheets("成交量").Range(Cells(i, m - 4), Cells(i, m))
Sheets("得分").Range("B1") = WorksheetFunction.Max(R5)
If V = WorksheetFunction.Max(Sheets("成交量").Range(Cells(i, m - 4), _
Cells(i, m))) Then
Sheets("得分").Cells(i, 6) = 1
End If
Next
执行后出现
执行阶段错误'1004':
应用程式或物件定义上的错误
有问题的是 "Set R5 = Sheets("成交量").Range(Cells(i, m - 4), Cells(i, m))"
这一列,我不知道这一列程式码有什么问题,请教大家帮我解惑,谢谢