简体   繁体   English

VBA隐藏/取消隐藏按钮

[英]VBA Hide/Unhide Button

Hello I'd like to use several VBA codes, shorter = better, I have this: 您好,我想使用几个VBA代码,较短=更好,我有这个:

Sub less0()
Security.UnlockS
    Range("15:29").Rows.Hidden = True
Security.LockS
End Sub

Sub more0()
Security.UnlockS
    Range("15:29").Rows.Hidden = False
Security.LockS
End Sub

But now I have one button and it need to be dynamical tryed this... 但是现在我有了一个按钮,需要动态地尝试一下...

Sub less001()
Security.UnlockS
Dim what As String: what = Range("18:26").Rows.Hidden
    If what = True Then what = False: If what = True Then Exit Sub
    If what = False Then what = True: If what = False Then Exit Sub
Security.LockS
End Sub 

(also lock problem) (也有锁定问题)

But it's not working and no debug /o\\ 但这不起作用,也没有调试/ o \\

Pls I have seen some similar codes here, but they are extremly complicated, I feel that this is a simple case. 请在这里看到一些类似的代码,但是它们非常复杂,我觉得这是一个简单的例子。

Thank you for your time. 感谢您的时间。

Sub less001()
    Security.UnlockS
    With Range("18:26").Rows
        .Hidden = Not .Hidden
    End with
    Security.LockS
End Sub 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM