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属性,但不能设置包含代码的复选框。