EXCEL通过VBA多条件查找怎样写?
提问一:1个条件查找;提问二:2个条件查找;提问三:3个条件查找;提问四:4个条件查找;谢谢单寻找表的条件取消,分数自动清空...
提问一:1个条件查找;提问二:2个条件查找;提问三:3个条件查找;提问四:4个条件查找;谢谢
单寻找表的条件取消,分数自动清空 展开
单寻找表的条件取消,分数自动清空 展开
1个回答
2016-01-09
展开全部
Sub 查找()
Dim i As Integer, j As Integer
arr1 = Sheets("档案").Range("A1:D" & Sheets("档案").Cells(Rows.Count, "A").End(xlUp).Row)
arr2 = Sheets("寻找").Range("A1:D" & Sheets("寻找").Cells(Rows.Count, "A").End(xlUp).Row)
For i = 1 To UBound(arr2)
For j = 1 To UBound(arr1)
If arr2(A, 1) = arr1(A 1) And arr2(B, 2) = arr1(B, 2) Then
arr2(iD 4) = arr1(D, 4)
GoTo 100
End If
Next
arr2(D, 4) = ""
100:
Next
Sheets("寻找").Range("A1:D" & Sheets("寻找").Cells(Rows.Count, "D").End(xlUp).Row) = arr2
End Sub
Dim i As Integer, j As Integer
arr1 = Sheets("档案").Range("A1:D" & Sheets("档案").Cells(Rows.Count, "A").End(xlUp).Row)
arr2 = Sheets("寻找").Range("A1:D" & Sheets("寻找").Cells(Rows.Count, "A").End(xlUp).Row)
For i = 1 To UBound(arr2)
For j = 1 To UBound(arr1)
If arr2(A, 1) = arr1(A 1) And arr2(B, 2) = arr1(B, 2) Then
arr2(iD 4) = arr1(D, 4)
GoTo 100
End If
Next
arr2(D, 4) = ""
100:
Next
Sheets("寻找").Range("A1:D" & Sheets("寻找").Cells(Rows.Count, "D").End(xlUp).Row) = arr2
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询