|
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 = 4 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 = 4 Then '选定1级,生成二级菜单
s = Cells(Target.Row, 4)
Target.Offset(0, 1).Clear
Target.Offset(0, 2).Clear
ElseIf Target.Column = 5 Then '选定2级,生成三级菜单
s = Cells(Target.Row, 4) & "," & Cells(Target.Row, 5)
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
|
评分
-
1
查看全部评分
-
|