在VBA中,字典技术的实例应用(一)
1、如图所示:筛选出第一次原料采购的单价?

3、会进入VBA编辑界面!点击菜单栏【插入】,在其下拉菜单中,选择【模块】!

5、在代码编辑窗口输入以下代码:Sub 第一次采购单价()[e1:f24].ClearSet d = CreateObject("scripting.dictionary")Set d1 = CreateObject("scripting.dictionary")On Error Resume Nextarr = Range("a1", Cells(Rows.Count, "c").End(xlUp))For i = 1 To UBound(arr) d.Add arr(i, 2), arr(i, 3) d1.Add arr(i, 2), arr(i, 1)Next[e1].Resize(d.Count) = Application.Transpose(d1.items)[f1].Resize(d.Count) = Application.Transpose(d.keys)[g1].Resize(d.Count) = Application.Transpose(d.items)End Sub

7、点击【第一次采购单价】按钮,第一次采购的单价会被瞬间列出!

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
阅读量:41
阅读量:25
阅读量:90
阅读量:38
阅读量:37