软件:EXCEL
VBA
版本:2010
这是我的VBA程式码,不知道为何在
"sumup = Application.WorksheetFunction.Index(tponumberrow, 1,
Application.WorksheetFunction.Match(vatoprange1, pricerow, 0)) +
Application.WorksheetFunction.Index(tponumberrow, 1,
Application.WorksheetFunction.Match(vatoprange2, pricerow, 0))"
一直出现出现错误"无法取得worksheetfunction的MATCH属性"
试了超级九还是不知道是哪里出了问题,有人可以帮我看一下吗><
以下是我的程式码
Sub 算VA()
Dim tponumberrow, abc As Range
Dim pricerow, bcd As Range
Dim varange()
Dim tponumber As Integer
Dim sumup As Integer
Dim sumdown As Integer
tponumberrow = Worksheets("运算").Range("c3:ST3")
pricerow = Worksheets("运算").Range("c4:ST4")
varange = Array(Worksheets("运算").Range("d2").Value)
Do While tponumber <= Worksheets("运算").Range("J2").Value * 0.7
Dim maxvarange As Integer
Dim minvarange As Integer
maxvarange = varange(LBound(varange))
minvarange = varange(LBound(varange))
For i = LBound(varange) + 1 To UBound(varange)
If maxvarange < varange(i) Then maxvarange = varange(i)
Next i
For i = LBound(varange) + 1 To UBound(varange)
If minvarange > varange(i) Then minvarange = varange(i)
Next i
Dim vatoprange1, vatoprange2, vabottomrange1, vabottomrange2 As Integer
vatoprange1 = maxvarange + 2
vatoprange2 = maxvarange + 1
vabottomrange1 = minvarange - 2
vabottomrange2 = minvarange - 1
sumup = Application.WorksheetFunction.Index(tponumberrow, 1,
Application.WorksheetFunction.Match(vatoprange1, pricerow, 0)) +
Application.WorksheetFunction.Index(tponumberrow, 1,
Application.WorksheetFunction.Match(vatoprange2, pricerow, 0))
sumdown = Application.WorksheetFunction.Index(tponumberrow, 1,
Application.WorksheetFunction.Match(vabottomrange1, pricerow, 0)) +
Application.WorksheetFunction.Index(tponumberrow, 1,
Application.WorksheetFunction.Match(vabottomrange2, pricerow, 0))
For i = LBound(varange) + 1 To UBound(varange)
If maxvarange < varange(i) Then maxvarange = varange(i)
Next i
For i = LBound(varange) + 1 To UBound(varange)
If minvarange > varange(i) Then minvarange = varange(i)
Next i
If sumup > sumdown Then
varange(LBound(varange) + 1) = maxvarange + 1
varange(LBound(varange) + 2) = maxvarange + 2
End If
Loop
MsgBox (maxvarange)
End Sub
非常不好意思我是初学者,也没有人可以询问,所以只能上来这边问了,
有人能够帮忙的话我会非常感激的QQ