Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/opengl/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vba Excel勾选框并锁定单元格_Vba - Fatal编程技术网

Vba Excel勾选框并锁定单元格

Vba Excel勾选框并锁定单元格,vba,Vba,亲爱的, 我需要执行以下操作的代码: 当我勾选一个复选框时,它应该冻结,这样就不可能编辑它,只要输入了密码 该复选框连接到一个单元格,并为其指定了以下宏: 也许这会被添加到已经存在的宏中 多谢各位 Sub CheckBox_Date_Stamp() Dim cbx As CheckBox 'Application.Caller returns the name of the CheckBox that called this macro Set cbx = ActiveSheet.Check

亲爱的, 我需要执行以下操作的代码: 当我勾选一个复选框时,它应该冻结,这样就不可能编辑它,只要输入了密码

该复选框连接到一个单元格,并为其指定了以下宏: 也许这会被添加到已经存在的宏中

多谢各位

Sub CheckBox_Date_Stamp()

Dim cbx As CheckBox

'Application.Caller returns the name of the CheckBox that called this macro
Set cbx = ActiveSheet.CheckBoxes(Application.Caller)

'.TopLeftCell returns the cell address located at the top left corner of the cbx checkbox
With cbx.TopLeftCell
    'Check the checkbox status (checked or unchecked)
    If cbx.Value = xlOn Then
        ' Checkbox is Checked
        ' User Name and Date-Time
        .Offset(0, 1).Value = Environ("UserName")
        .Offset(0, 2).Value = Now
    Else
        ' Checkbox is unchecked; Clear cell contents?
        .Offset(0, 1).ClearContents
        .Offset(0, 2).ClearContents
    End If
End With

有人能帮忙吗?有人能帮忙吗?可能是复制品。尽管该链接中有信息,但我可以设置另一个复选框的Enabled属性,但不能设置包含代码的复选框。