|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Sub 宏2()
- Dim arr, d As Object, T$, i&
- Set d = CreateObject("scripting.dictionary")
- arr = Sheet2.[a1].CurrentRegion
- For i = 2 To UBound(arr)
- T = arr(i, 1) & "|" & arr(i, 2)
- d(T) = arr(i, 3)
- Next i
- arr = Sheet1.[a1].CurrentRegion
- For i = 2 To UBound(arr)
- If d.Exists((arr(i, 1)) & "|" & arr(i, 3)) Then
- arr(i, 5) = d((arr(i, 1)) & "|" & arr(i, 3))
- ElseIf d.Exists((arr(i, 1) - 1) & "|" & arr(i, 3)) Then
- arr(i, 5) = d((arr(i, 1) - 1) & "|" & arr(i, 3)) & "(上日数据)"
- Else
- arr(i, 5) = "#NA"
- End If
- Next i
- [a1].Resize(UBound(arr), UBound(arr, 2)) = arr
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|