|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Option Explicit
Sub test()
Dim arr, dic, i
Set dic = CreateObject("scripting.dictionary")
arr = [a1].CurrentRegion
ReDim brr(1 To UBound(arr, 1) - 1, 1 To 1)
For i = 2 To UBound(arr, 1)
If Len(arr(i, 5)) = 0 Then Exit For
dic(arr(i, 5)) = arr(i, 6)
Next
For i = 2 To UBound(arr, 1)
If dic.exists(arr(i, 3)) Then brr(i - 1, 1) = dic(arr(i, 3))
Next
[d2].Resize(UBound(brr, 1)) = brr
End Sub
根据条件赋值,如果C列和E列中的值相等,则把D列赋予对应的F列的值。
但是这个代码运行提示下标越界,求帮忙
工作簿1.zip
(11.06 KB, 下载次数: 4)
|
|