|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
本帖最后由 Hontyu 于 2023-5-4 09:27 编辑
- <div class="blockcode"><blockquote>Sub TEST()
- Dim ar, br, Sht, iR, iC, i, j
- Dim d: Set d = CreateObject("Scripting.Dictionary")
- Application.ScreenUpdating = False
- With Sheet2.[D1].CurrentRegion
- .Offset(3, 2).ClearContents
- ar = .Value
- End With
- For i = 4 To UBound(ar): d(ar(i, 2)) = i: Next
- For j = 3 To UBound(ar, 2): d(ar(1, j)) = j: Next
- For Each Sht In Sheets
- With Sht
- If .Name <> "结果" Then
- If Application.CountA(.UsedRange.Cells) = 0 Then
- Exit For
- End If
- br = .UsedRange
- For i = 2 To UBound(br)
- If d.Exists(br(i, 2)) Then
- iR = d(br(i, 2))
- If d.Exists(Val(.Name)) Then
- iC = d(Val(.Name))
- ar(iR, iC) = Val(br(i, 11))
- End If
- End If
- Next i
- End If
- End With
- Next Sht
- Sheet2.[D1].Resize(UBound(ar), UBound(ar, 2)) = ar
- Set d = Nothing
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
评分
-
1
查看全部评分
-
|