Hi!
I have used the below VBA code so i can make multiple sections within a cell from a drop down list. This was all working fine and i could easily delete any section i made, but now i can't. When i select an option and then try and delete it form the cell by pressing delete or backspace, it doesn't remove it. Does anyone know why? Not sure if i need to change the code or not...
I have used the below VBA code so i can make multiple sections within a cell from a drop down list. This was all working fine and i could easily delete any section i made, but now i can't. When i select an option and then try and delete it form the cell by pressing delete or backspace, it doesn't remove it. Does anyone know why? Not sure if i need to change the code or not...
VBA Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Oldvalue As String
Dim Newvalue As String
Application.EnableEvents = True
On Error GoTo Exitsub
If Not Intersect(Target, Range("N:N,M:M")) Is Nothing Then
If Target.SpecialCells(xlCellTypeAllValidation) Is Nothing Then
GoTo Exitsub
Else: If Target.Value = "" Then GoTo Exitsub Else
Application.EnableEvents = False
Newvalue = Target.Value
Application.Undo
Oldvalue = Target.Value
If Oldvalue = "" Then
Target.Value = Newvalue
Else
If InStr(1, Oldvalue, Newvalue) = 0 Then
Target.Value = Oldvalue & ", " & Newvalue
Else:
Target.Value = Oldvalue
End If
End If
End If
End If
Application.EnableEvents = True
Exitsub:
Application.EnableEvents = True
End Sub
Last edited by a moderator: