|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
重在参与。。。
- Sub ykcbf() '//2024.7.26
- Application.ScreenUpdating = False
- Set sh = ThisWorkbook.Sheets("Sheet0")
- st = sh.[a1].Value & "|" & sh.[b1].Value
- ReDim brr(1 To 10000, 1 To 9)
- For Each sht In Sheets
- If sht.Name <> sh.Name Then
- With sht
- r = .Cells(Rows.Count, 1).End(3).Row
- arr = .[a1].Resize(r, 8)
- For i = 2 To UBound(arr)
- If arr(i, 7) & "|" & arr(i, 8) = st Then
- m = m + 1
- For j = 1 To UBound(arr, 2)
- brr(m, j) = arr(i, j)
- Next
- brr(m, 9) = .Name
- End If
- Next
- End With
- End If
- Next
- With sh
- .[a5:i10000] = ""
- .[a5].Resize(m, 9) = brr
- End With
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
|