|
本来简单,但楼主挖了好几个坑。
- Sub ykcbf() '//2024.8.12 客户查询
- Application.ScreenUpdating = False
- With Sheets("汇总台帐 ")
- r = .Cells(Rows.Count, 1).End(3).Row
- c = .Cells(3, "XFD").End(1).Column
- arr = .[a1].Resize(r, c)
- End With
- ReDim brr(1 To 1000, 1 To 18)
- ReDim crr(1 To 1000, 1 To 18)
- On Error Resume Next
- With Sheets("客户查询")
- st = .[e2].Value
- For i = 6 To UBound(arr)
- If InStr(arr(i, 2), st) Then
- m = m + 1
- For j = 1 To 18
- brr(m, j) = arr(i, j)
- Next
- For j = 19 To 29
- crr(m, j - 18) = arr(i, j)
- Next
- For j = 30 To c
- crr(m, j - 15) = arr(i, j)
- Next
- End If
- Next
- .[a5].Resize(6, 100) = ""
- .[a12].Resize(6, 100) = ""
- .[a5].Resize(m, 18) = brr
- .[b12].Resize(m, 17) = crr
- End With
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
|