此代码有效但A列中的单元格数据仍然存在。我尝试添加Target.ClearContents
,但这会在双击时删除这两个单元格。
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Not Intersect(Target, Range("A1:A5")) Is Nothing Then
Cancel = True
If Application.CountIf(Sheets("Sheet3").Range("C:C"), Target.Value) = 0 Then
Cells(Target.Row, 3).Value = Target.Value
Target.ClearContents
End If
End If
End Sub