|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
参与一下。。。
- Sub ykcbf() '//2024.4.11
- Set d = CreateObject("Scripting.Dictionary")
- st = InputBox("请输入月计划号进行查询", "月计划号", "8033")
- If Len(st) = 0 Then Exit Sub
- With Sheets("B表")
- c = 23
- For j = 2 To c
- s = .Cells(1, j)
- If s <> Empty Then d(s) = j - 1
- Next
- End With
- With Sheets("A表")
- r = .Cells(Rows.Count, 2).End(3).Row
- arr = .[a1].Resize(r, 17)
- End With
- ReDim brr(1 To 1, 1 To 23)
- For i = 2 To UBound(arr)
- If CStr(arr(i, 2)) = st Then
- For j = 2 To 17
- s = arr(1, j)
- If s <> Empty Then
- If d.exists(s) Then
- brr(1, d(s)) = arr(i, j)
- End If
- End If
- Next
- End If
- Next
- With Sheets("B表")
- .[b2:w2] = ""
- .[b2].Resize(1, 22) = brr
- End With
- Set d = Nothing
- MsgBox "OK!"
- End Sub
复制代码
|
评分
-
1
查看全部评分
-
|