|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Private Sub Worksheet_SelectionChange(ByVal Target As Range)
- If Target.Count > 1 Then Exit Sub
- If Target.Row = 1 Then Exit Sub
- Dim ML As New multilevel
- If Target.Column = 1 Then '选定首列,生成一级菜单
- With Worksheets("菜单")
- k0 = .[c1].End(4).Row
- ML.DataList = .Range("a1:c" & k0).Value '基础数据
- End With
- ML.Lists Target
- End If
- End Sub
- Private Sub Worksheet_Change(ByVal Target As Range)
- If Target.Row = 1 Then Exit Sub
- If Target.Column = 1 Then '选定1级,生成二级菜单
- s = Cells(Target.Row, 1)
- Target.Offset(0, 1).Clear
- Target.Offset(0, 2).Clear
- ElseIf Target.Column = 2 Then '选定2级,生成三级菜单
- s = Cells(Target.Row, 1) & "," & Cells(Target.Row, 2)
- Target.Offset(0, 1).Clear
- Else
- Exit Sub
- End If
- Dim ML As New multilevel
- With Worksheets("菜单")
- k0 = .[c1].End(4).Row
- ML.DataList = .Range("a1:c" & k0).Value '基础数据
- End With
- ML.Lists Target.Offset(0, 1), s
- End Sub
复制代码 向楼主学习,类模块原装 ,利用工作表事件 组合制作 3级联动菜单。
城市下拉菜单2019.rar
(85.94 KB, 下载次数: 119)
|
评分
-
2
查看全部评分
-
|