我对VBA(刚刚开始学习)不是很熟悉,我正在尝试修改以下编码,以便目标不在当前工作表的第1行,但它指向单元格A1到“Calc”工作表。请记住,“Calc”工作表将被隐藏和锁定。
最后,我想要实现的是双击单元格并显示/删除复选标记。然后,根据是否存在复选标记进行其他计算。
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Intersect(Target, Range("E4,E6,I8,E10")) Is Nothing Then Exit Sub
With Target(1)
.Font.Name = "Wingdings"
.Value = IIf(.Value = "ü", "", "ü")
Cancel = True
End With
End Sub
答案 0 :(得分:0)
也许:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Intersect(Target, Range("E4,E6,I8,E10")) Is Nothing Then Exit Sub
Cancel = True
With Target
.Font.Name = "Marlett"
If .Value = "" Then
.Value = "a"
Else
.Value = ""
End If
End With
End Sub
请记住,这可以在工作表代码区域中找到。
注意:强>
Cancel
以避免以Edit
模式结束Marlett
使用小写 a 以方便输入