Excel 的下拉菜单问题
求助各位大佬,这个下拉的公式怎么写?不是公式是数据有效性这个菜单里面 b列排下序然后用offset+match+countif 有效性里的公式怎么写啊
哥,E列我需要的下拉菜单是a3,a4,a6,a8,a9,都是B类的名称 哥,我连的是SQL server,数据都是变化的,所以公式不可以写死啊 哥,我连的是SQL server,数据是及时更新的,所以公式不能写死了 给你一个VBA版本的,点击这两个单元格,会自动下拉!
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim arr
r = Target.Row: j = Target.Column
If j = 5 Then
If r = 1 Then
Set d1 = CreateObject("Scripting.Dictionary")
arr = Sheets("Sheet1").UsedRange
For i = 2 To UBound(arr)
If arr(i, 2) = "A类" Then d1(arr(i, 1) & "") = ""
Next
With Range("e1").Validation
.Delete
.Add 3, 1, 1, Join(d1.keys, ",")
End With
CreateObject("Wscript.Shell").SendKeys "%{down}"
ElseIf r = 2 Then
Set d2 = CreateObject("Scripting.Dictionary")
arr = Sheets("Sheet1").UsedRange
For i = 2 To UBound(arr)
If arr(i, 2) = "B类" Then d2(arr(i, 1) & "") = ""
Next
With Range("e2").Validation
.Delete
.Add 3, 1, 1, Join(d2.keys, ",")
End With
CreateObject("Wscript.Shell").SendKeys "%{down}"
Else
End If
End If
End Sub