据我所知,大多数情况下,如果没有终止,则会发生此错误,但我似乎无法找到它。我是Excel VBA的初学者,所以请耐心等待。这是我的代码。基本上,这个宏的要点是读取a9和b9中选定的值配对,然后搜索结果列表,直到它与a9和b9中的值对应,然后将1添加到该特定行的列上。 / p>
Dim z As Integer
z = 42
'If selected adc = adc in row z
' Then if selected sp = sp in row z
'Add 1 to win column in row z
If [a9] = [g[z]] Then
If [b9] = [h[z]] Then
[i[z]] = [i[z]] + 1
End If
'Elseif selected adc =/= adc in row z
'Then add 1 to row
'Do until selected adc = adc in row z
ElseIf [a9] <> [g[z]] Then
z = z + 1
Do Until [a9].Text = [g[z]].Text
Exit Do
'If selected sp = sp in row z
'Then add 1 to column h (win column) in row z
If [b9] = [h[z]] Then
[i[z]] = [i[z]] + 1
End If
'If selected sp =/= sp in row z
'Then add 1 to row
'Do until selected sp = sp in row z
If [b9] <> [h[z]] Then
z = z + 1
Do Until [b9].Text = [h[z]].Text
Exit Do
If [b9] = [h[z]] Then
[i[z]] = [i[z]] + 1
End If