Forum Discussion
littlebethan
May 23, 2023Copper Contributor
Clearing contents of a cell based on the contents of another
Hi All, Is there any way of clearing the contents of a cell based on if another cell has data in it? For example, on one of my spreadsheets there is a column for email addresses (COL D) and ...
OliverScheurich
May 23, 2023Gold Contributor
Private Sub Worksheet_Change(ByVal Target As Range)
Dim rngBereich As Range
Set rngBereich = Range("M:M")
If Target.Cells.Count > 1 Then GoTo done
If Not Application.Intersect(Target, rngBereich) Is Nothing Then
If Target.Value <> "" Then
Target.Offset(0, -9).Value = ""
Else
End If
End If
done:
Application.EnableEvents = True
Exit Sub
End SubYou can try the Worksheet_Change event If you enter any text in column M the mail address in the corresponding row of column D is deleted.