وعليكم السلام يمكن عمل هذا بهذا الكود في حدث الصفحة
وبالنسبة عن كيفية تطبيق هذا بملف اخر فيمكنك دراسة الكود جيدا ونقله وتطويعه في عمل اخر
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
'Only run the code if the user selected a cell in our defined range:
If Not Intersect(Target, Me.Range("Table_Schedule")) Is Nothing Then
'Declare variables
Dim rInt As Range
Dim rCell As Range
Dim rw As Long
Dim xLoc As Range
Set rInt = Me.Range(Me.Cells(Target.Row, "d"), Me.Cells(Target.Row, "p"))
If Not rInt Is Nothing Then
'Look for a response in our answer range
Set xLoc = rInt.Find("x ")
If Not xLoc Is Nothing Then
'If there was a response and the response was in the same column _
'we selected, wipe the response and exit the sub.
If Target.Column = xLoc.Column Then
rInt.Value = vbNullString
Exit Sub
'Else, wipe the previous response and add the new response
Else
rInt.Value = vbNullString
Target.Value = "x "
End If
'If there were no previous responses...
Else: Target.Value = "x "
End If
End If
End If
End Sub
Weekly chore schedule1.xlsm