vba 使用复选框隐藏/取消隐藏行

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25179658/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-12 04:07:19  来源:igfitidea点击:

Hide/unhide rows with a check box

excelvba

提问by Jim

I am working on a sheet where I need to hide / unhide rows based on whether or not the box is checked, I currently have the following code

我正在处理一个工作表,我需要根据是否选中该框来隐藏/取消隐藏行,我目前有以下代码

Private Sub CheckBox3_Click()
If CheckBox3 = True Then
[75:86].EntireRow.Hidden = False
Else: [75:86].EntireRow.Hidden = True
End If
End Sub

Which hides unhides Rows 75:86, however I wish to unhide/hide rows 75:86 AND rows 100:125 Any help would be appreciated

其中隐藏取消隐藏行 75:86,但是我希望取消隐藏/隐藏行 75:86 AND 行 100:125 任何帮助将不胜感激

Thanks

谢谢

回答by AtmiyaDas2014

Private Sub CheckBox3_Click()
If CheckBox3 = True Then
[75:86].EntireRow.Hidden = False
Else: 
[75:86].EntireRow.Hidden = True
[100:125].EntireRow.Hidden = True
End If
End Sub