|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
本帖最后由 lm1221 于 2014-10-29 20:13 编辑
532695416 发表于 2014-10-29 17:51
有一个功能没实现:F列需要根据2个B3和C列,2个单元格进行查询
比如:f6需要根据B3跟c6,2个单元格在 ...
好复杂的附件!好复杂的说明!好复杂的模拟!呵呵,猜下吧!
- Sub test()
- Dim ar, ar1, a2(), i&, s$, k&, j&
- s = Right(Range("b3").Value, 1)
- ar = Sheet2.[a1].CurrentRegion
- ar1 = Sheet3.[a1].CurrentRegion
- ReDim ar2(1 To UBound(ar), 1 To 7)
- For i = 2 To UBound(ar)
- If Right(ar(i, 1), 1) = s Then
- k = k + 1
- ar2(k, 1) = ar(i, 7): ar2(k, 4) = ar(i, 10)
- End If
- Next i
- For m = 1 To k
- For i = 2 To UBound(ar1)
- If s & "|" & ar2(m, 1) = Right(ar1(i, 2), 1) & "|" & ar1(i, 3) Then ar2(m, 7) = ar1(i, 6)
- Next i
- Next m
- [c6].Resize(k, 7) = ""
- [c6].Resize(k, 7) = ar2
- End Sub
复制代码
|
|