Hey Guys,

Trying to implement the following: I have 4 columns (C,D,E, and F). If a user inputs any data in any cell in ColumnC then Column D is automatically filled with value "Y". I was able to implement this part, which works ok. What I need to do now is when user inputs any data in any cell in column E (let's say E4), then corresponding cell in column D (D4) or column F(F4) needs to be cleared (meaning that there can be only one "Y" value in the row between D4 and F4). And if Column C is empty, then Columns D, E, and F are also empty.

Woooph, I hope you understand what I need to implement, if not, pls ask for more info. Below is the starting code:


Sub PopulateB()

Dim rng As Range, rng2 As Range, cell As Range

Set rng = Range("C4:C10")
Set rng2 = Range("e4:e10")

If Not rng Is Nothing Then

    For Each cell In rng.Cells
        If cell.Value <> "" Then
           cell.Offset(0, 1).Value = "Y"
        Else
           cell.Offset(0, 1).ClearContents
           
        End If
    Next
End If

End Sub
Any suggestions and thank you!