急急急!!!!EXCEL自定义函数无法调用
我在EXCEl里面自定义了一个函数
如下:
Function sumScoreA(startRow As Range, endRow As Range)
sumScoreA = 0
row1 = startRow.Value
row2 = endRow.Value
If row1 < row2 Then
For i = row1 To row2
tiMuNo = Trim(Sheet1.Cells(i, 1).Value)
answer = Trim(Sheet1.Cells(i, 2).Value)
tempScore = 0
myIndex = 0
For j = 2 To 11
oneType = Trim(Sheet2.Cells(j, 2).Value)
If tiMuNo = onType Then
myIndex = j
End If
Next
Select Case answer
Case Is = Trim(Sheet2.Cells(myIndex, 3).Value)
tempScore = Trim(Sheet2.Cells(myIndex, 4).Value)
Case Is = Trim(Sheet2.Cells(myIndex, 5).Value)
tempScore = Trim(Sheet2.Cells(myIndex, 6).Value)
Case Is = Trim(Sheet2.Cells(myIndex, 7).Value)
tempScore = Trim(Sheet2.Cells(myIndex, 8).Value)
End Select
sumScoreA = sumScoreA + tempScore
Next
End If
End Function
总是显示无效名称,紧急求助