|
本帖最后由 orr89 于 2020-2-29 12:45 编辑
感觉就像接了一个单。话说我们这样真的好么,什么都写好了,求助者真的会研究么。虽然我也是菜鸟。
Private Sub Workbook_Open()
Dim dic
Set dic = CreateObject("scripting.dictionary")
arr = Sheet2.Range("a1").CurrentRegion
For a = 2 To UBound(arr)
If Not dic.exists(arr(a, 2)) Then dic(arr(a, 2)) = ""
Next
Sheet3.Shapes("下拉框 4").ControlFormat.RemoveAllItems
For x = 1 To dic.Count
Sheet3.Shapes("下拉框 4").ControlFormat.AddItem dic.keys()(x - 1)
Next
End Sub
Sub 查询()
第几项 = ActiveSheet.DropDowns("下拉框 4").Value
条件 = Sheet3.Shapes("下拉框 4").ControlFormat.List(第几项)
arr = Sheet2.Range("a1").CurrentRegion
ReDim brr(1 To UBound(arr) * 3, 1 To 9)
n = 1
For a = 2 To UBound(arr)
If arr(a, 2) & "" = 条件 Then
brr(n, 1) = arr(a, 8) '编码
brr(n, 3) = arr(a, 9) '部件编号
brr(n, 4) = arr(a, 10) '型号
brr(n, 5) = arr(a, 11) '规格参数
brr(n, 7) = arr(a, 12) '单位
brr(n, 9) = arr(a, 13) '数量
n = n + 3
End If
Next
Range("e5:m10000").ClearContents
[e5].Resize(n, 9) = brr
End Sub
Sub 更新日期()
Dim dic
Set dic = CreateObject("scripting.dictionary")
arr = Sheet2.Range("a1").CurrentRegion
For a = 2 To UBound(arr)
If Not dic.exists(arr(a, 2)) Then dic(arr(a, 2)) = ""
Next
Sheet3.Shapes("下拉框 4").ControlFormat.RemoveAllItems
For x = 1 To dic.Count
Sheet3.Shapes("下拉框 4").ControlFormat.AddItem dic.keys()(x - 1)
Next
End Sub
|
|