我有一个Worksheet_SelectionChange子,它可以在点击它们时更改一系列单元格,并且" On"或"关":
play
这些范围应确定是应显示还是隐藏某些表。我尝试过使用这个Worksheet_Change代码:
Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
Application.EnableEvents = False
If Target.Cells.Count = 1 Then
If Not Intersect(Target, Range("Point_load, Line_load, Uniform_load,
Informed_moment, Steel_bar_moment, Steel_bar_reinforcement")) Is Nothing Then
Select Case Target.Value
Case Range("Yes").Value
Target.Value = Range("No").Value
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.Color = 255
.TintAndShade = 0
.PatternTintAndShade = 0
End With
With Selection.Font
.ThemeColor = xlThemeColorDark1
.TintAndShade = 0
End With
With Selection
.Offset(0, 1).Select
End With
Case Range("No").Value
Target.Value = Range("Yes").Value
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorAccent6
.TintAndShade = 0
.PatternTintAndShade = 0
End With
With Selection.Font
.ThemeColor = xlThemeColorDark1
.TintAndShade = 0
End With
With Selection
.Offset(0, 1).Select
End With
End Select
End If
End If
Application.EnableEvents = True
End Sub
但是,它不起作用,就像工作表更改没有从选择更改代码注册更改。我已将表定义为ListObject。点击例如,你可以帮我隐藏/取消隐藏示例中的表格吗? " Point_load"细胞
提前致谢!