我对Vba脚本非常陌生,需要我的vba脚本帮助
期望:
如果excel数据如下:
R/C Col1 Col2 Col3
Row1 1 1 1
Row2 0 0 0
Row3 1 0 1
Row4 0 0 0
输出应该是值为0的所有行的列表之一在上面的示例中,它将输出Row2和Row4
代码:
Sub LookUp()
Dim result As String
Dim i As Long
Dim j As Long
For i = 2 To Rows.Count
result = "Pass"
For j = 2 To Columns.Count
If Cells(i, j).Value = 0 Then
Continue
ElseIf j = 2 And IsEmpty(Cells(i, j).Value) Then
result = "End"
Exit For
ElseIf IsEmpty(Cells(i, j).Value) Then
Exit For
Else
result = ""
Exit For
End If
Next j
If result = "Pass" Then
Cells(i, j + 5).Value = Cells(i, 1).Value
ElseIf result = "End" Then
Exit For
End If
Next i
End Sub
错误:未定义子函数或函数
(此错误在添加else条件后出现)
可能是