想在检索表里实现按合同编号和施工单位模糊查找筛选的,但是总是提示下标越界,检索出的内容也只显示8列的内容,其他的都显示不出来,求大神赐教指导下!
Sub gj23w98()Dim brr(1 To 5000, 1 To 28)
新建 Microsoft Office Excel 2007 工作簿.zip
(939.97 KB)
For Each sht In Sheets
If sht.Name <> ActiveSheet.Name Then
With sht
r = .Cells(.Rows.Count, 1).End(3).Row
arr = .Range("a3:i" & r)
End With
For i = 1 To UBound(arr)
If InStr(arr(i, 3), [c1]) > 0 Or InStr(arr(i, 20), [f1]) > 0 Then
m = m + 1
For j = 1 To UBound(arr, 2)
brr(m, j) = arr(i, j)
Next
End If
Next
End If
Next
If m > 0 Then
Range("a3:i" & Rows.Count).ClearContents
[a3].Resize(m, 28) = brr
Else
MsgBox "没有找到相关数据,请查证!"
End If
End Sub