操作系统层面的VB?
还是Excel层面的VBA?
如果是在Excel中:
Option Explicit
Public oldCell As String
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Count > 1 Or Target.Column <> 3 Then
If oldCell <> "" Then Range(oldCell).NumberFormatLocal = """***"""
oldCell = ""
Else
Target.NumberFormat = ""
If oldCell <> "" Then Range(oldCell).NumberFormatLocal = """***"""
oldCell = Target.Address
End If
End Sub
附件可下载参考
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
myrow = Range("c65535").End(xlUp).Row
Range("c1:c" & myrow).NumberFormatLocal = """***"""
Target.NumberFormatLocal = 0
End Sub
把代码放到对应的工作表代码窗口里面