Not_Again
New Member
- Joined
- Feb 4, 2025
- Messages
- 3
- Office Version
- 365
- Platform
- Windows
Hello. I am trying to make a dropdown in which you can select more than one choice per cell. It is working well, UNTIL I try to create the data validation in a cell that is within a table. (See picture)
If I use the code and data validation in a cell NOT in a table, it works great. How can I get a multichoice dropdown in a cell that is in a table?
This is the code I am using:
Thank you for helping!!
If I use the code and data validation in a cell NOT in a table, it works great. How can I get a multichoice dropdown in a cell that is in a table?
This is the code I am using:
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
Const rngA = "K2:K1639"
If Not Intersect(Target, Target.Parent.Range(rngA)) 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
Thank you for helping!!
Attachments
Last edited by a moderator: