|
楼主 |
发表于 2024-12-15 16:43
|
显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
- Sub 查找h列()
- Dim arr, brr
- Dim dic
- Set dic = CreateObject("scripting.dictionary")
- arr = Sheets(1).[al].Resize(10000, 9)
- For x = 2 To UBound(arr)
- If Len(arr(x, l)) Then
- dic("'" & arr(x, 1)) = x
- End If
- Next
- Sheets(2).[b3].Resize(10000, 1).ClearContents
- brr = Sheets(2).[a2].CurrentRegion
- For i = 2 To UBound(brr)
- If dic.exists("'" & brr(i, 1)) Then
- brr(i, 2) = arr(dic("'" & brr(i, 1)), 8)
- Else
- k = k + 1
- End If
- Next
- Sheets(2).[a3].CurrentRegion = brr
- MsgBox "还有" & k & "个未找到!"
- End Sub
复制代码 代码核对过了,,没抄错啊,,老提示下标越界
|
|