I want to apply the below VB code on the whole column "I " kindly guided please
Private Sub Worksheet_Change(ByVal Target As Range)
' Initializing variables
Dim oldVal As String
Dim newVal As String
' Checking for changes in the drop down lists
Application.EnableEvents = True
If Target.Address = "$I$4" Or Target.Address = "$G$3" Then
If Target.SpecialCells(xlCellTypeAllValidation) Is Nothing Then
Exit Sub
' Adding the multiple selected items to the list
Else
If Target.Value = "" Then
Exit Sub
Else
Application.EnableEvents = False
newVal = Target.Value
Application.Undo
oldVal = Target.Value
If oldVal = "" Then
Target.Value = newVal
Else
If InStr(oldVal, newVal) = 0 Then
Target.Value = oldVal & ", " & newVal '& vbNewLine &
Else
Target.Value = oldVal
End If
End If
End If
End If
End If
Application.EnableEvents = True
End Sub
Bookmarks