Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.CountLarge = 1 And Not Intersect(Range("B:E"), Target) Is Nothing Then
Application.EnableEvents = False
Dim i As Long
With Range(Cells(Target.Row, 2), Cells(Target.Row, 5))
i = WorksheetFunction.CountIf(.Cells, "x")
If i > 1 Then
MsgBox "Only one category allowed per word"
Target = ""
End If
End With
Application.EnableEvents = True
End If
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
Application.EnableEvents = False
TargetAdd = Target.Address
Call ClearOtherCells(TargetAdd)
Application.EnableEvents = True
End Sub
Sub ClearOtherCells(TargetAddress As Variant)
Dim ColumnChanged As Integer
Dim RowChanged As Integer
Dim ColumnOffset As Integer
Dim i As Integer
RowChanged = Range(TargetAddress).Row
ColumnChanged = Range(TargetAddress).Column
' This ensures only B2:E5 are processed
If (RowChanged >= 2 And RowChanged <= 5 And ColumnChanged >= 2 And ColumnChanged <= 5) = False Then Exit Sub
'Loop for number of columns
For i = 2 To 5
ColumnOffset = i - ColumnChanged
If ColumnOffset <> 0 Then
Range(TargetAddress).Offset(0, ColumnOffset).ClearContents
End If
Next i
End Sub