单击时如何锁定复选框 [英] How to Lock a Check box when Clicked

查看:65
本文介绍了单击时如何锁定复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我正在尝试选中一个复选框.所以你不能取消检查这里是我得到的.但它似乎不起作用

Hello I am trying to lock a check box when it is checked. So you can't un check it here is what i got. but its not seeming to work

Sub CheckBox1_Click()
If CheckBox1 = True Then
ActiveSheet.CheckBoxe1.Enabled = False
End If
End Sub

推荐答案

在禁用具有焦点的控件之前,需要将焦点设置在其他控件(另一个复选框,文本字段或其他控件)上)

Before you can disable a control that has the focus, you need to set the focus on some other control (another check box, a text field, or something else)

sub CheckBox1_Click()
    if CheckBox1 = True Then
        SomeOtherControl.setFocus
        CheckBox1.Enabled = False
    end if
end sub

这篇关于单击时如何锁定复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆