|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
- Sub 查找()
- Dim m, n, i, j, arr, brr, crr()
- Range("AC3:AJ24") = ""
- arr = Range("D3:O24").Value
- ReDim brr(1 To UBound(arr), 1 To UBound(arr, 2))
- For i = 1 To UBound(arr)
- n = 0
- For j = 1 To UBound(arr, 2) Step 2
- If InStr(arr(i, j), "BZ") Then
- n = n + 2
- brr(i, n - 1) = arr(i, j)
- brr(i, n) = arr(i, j + 1)
- End If
- Next
- Next
- m = 0
- ReDim crr(1 To UBound(arr), 1 To 12)
- For i = 1 To UBound(brr)
- If brr(i, 1) <> "" Then
- m = m + 1
- For j = 1 To 12
- crr(m, j) = brr(i, j)
- Next
- End If
- Next
- If m > 0 Then [AC3].Resize(m, 12) = crr
- End Sub
复制代码 |
|