I am trying to use vba code to allow multiple entries in one cell using a data validation dropdown list and the Worksheet change event. It just does not work and I have spent hours trying to figure it out. The code works on a sample spreadsheet I downloaded with the code. I have an MX tools AddIn and ran the Review Code option It came up with the following: Ribbon X 'The parameter controls is not used' and on the Worksheet Change it said 'The procedure Worksheet Change is not used' Any suggestions or advice gratefully appreciated. Here's the code for the Worksheet Change procedure (Target Column 30 is correct in the code): Private Workheet_Change(ByVal Target As Range)
Dim rngDV As Range
Set rngDV = Range("AD2:AD5")
Dim oldVal As String
Dim newVal As String
If Target.Count > 1 Then GoTo exitHandler
On Error Resume Next
Set rngDV = Cells.SpecialCells(xlCellTypeAllValidation)
On Error GoTo exitHandler
If rngDV Is Nothing Then GoTo exitHandler
If Intersect(Target, rngDV) Is Nothing Then
'do nothing
Else
Application.EnableEvents = False
newVal = Target.Value
Application.Undo
oldVal = Target.Value
Target.Value = newVal
If Target.Column = 30 Then
If oldVal = "" Then
'do nothing
Else
If newVal = "" Then
'do nothing
Else
Target.Value = oldVal _
& ", " & newVal
End If
End If
End If
End If
exitHandler:
Application.EnableEvents = True
End Sub
Dim rngDV As Range
Set rngDV = Range("AD2:AD5")
Dim oldVal As String
Dim newVal As String
If Target.Count > 1 Then GoTo exitHandler
On Error Resume Next
Set rngDV = Cells.SpecialCells(xlCellTypeAllValidation)
On Error GoTo exitHandler
If rngDV Is Nothing Then GoTo exitHandler
If Intersect(Target, rngDV) Is Nothing Then
'do nothing
Else
Application.EnableEvents = False
newVal = Target.Value
Application.Undo
oldVal = Target.Value
Target.Value = newVal
If Target.Column = 30 Then
If oldVal = "" Then
'do nothing
Else
If newVal = "" Then
'do nothing
Else
Target.Value = oldVal _
& ", " & newVal
End If
End If
End If
End If
exitHandler:
Application.EnableEvents = True
End Sub