|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
请教如何放大下拉菜单的字号?
以山菊花总版主论坛代码为例(谢谢总版)。
代码来源:https://club.excelhome.net/threa ... tml?_dsign=ba8b3d8c
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim nRow%, arr, i&, s, cSh$
Dim d As Object
cSh = IIf(Target.Address = "$A$2", "客户", IIf(Target.Address = "$B$2", "数据库", ""))
If cSh = "" Then Exit Sub
Set d = CreateObject("scripting.dictionary") '后期字典
With Sheets(cSh)
nRow = .Range("a1048576").End(xlUp).Row
arr = .Range("a1:a" & nRow).Value
End With
For i = 2 To nRow 'D1是标题,从第2行开始遍历数据源,装入字典
If arr(i, 1) <> "" Then d(arr(i, 1)) = ""
Next
s = Join(d.keys, ",")
With Target.Validation
.Delete '删掉旧的
.Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, _
Operator:=xlBetween, Formula1:=s 'S为数据验证的序列来源
End With
'Application.SendKeys "%{down}" '加这个代码,鼠标放上去直接伸出下拉菜单atl+↓直接弹出数据验证下拉列表
Set d = Nothing '释放字典
End Sub
|
|