• Privacywetgeving
    Het is bij Helpmij.nl niet toegestaan om persoonsgegevens in een voorbeeld te plaatsen. Alle voorbeelden die persoonsgegevens bevatten zullen zonder opgaaf van reden verwijderd worden. In de vraag zal specifiek vermeld moeten worden dat het om fictieve namen gaat.

Excel dropdown with multiple selection

Status
Niet open voor verdere reacties.

SalesSupportNR

Nieuwe gebruiker
Lid geworden
11 apr 2017
Berichten
2
HI, I have been trying to create a dropdown with multiple selection possibility in attached sheet and cannot get the VBA part to work. as of now I can only get a single dropdown. Is there anyone out there that can help with formatting this properly?
the idea is that the the OEM's listed on Sheet2 C1:C11 can be selected on Sheet1 column G under 'OEM's'

Thanks in advance.
 

Bijlagen

  • Contact_Sheet_DirectMarketing.xlsx
    10,5 KB · Weergaven: 35
multiple selection in dropdown ? (I guess you mean listbox)
But with the dropdown, select a value and then select the next, etc.
Is this the idea?
See example.

Je mag gerust je vraag in het Nederlands stellen op een Nederlands forum Kristineke;)
 

Bijlagen

  • Contact_Sheet_DirectMarketing.xlsb
    16,2 KB · Weergaven: 54
Zonder dubbelingen

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim nieuw As String, oud As String
If Target.Column <> 7 And Target.Count > 1 Then Exit Sub
  With Application
    .EnableEvents = False
    nieuw = Target
    .Undo
    oud = Target
    If nieuw = "" Then
      Target = ""
     Else
      If InStr(oud, nieuw) = 0 Then
        oud = IIf(oud = "", nieuw, oud & ", " & nieuw)
        Target = oud
      End If
    End If
    .EnableEvents = True
  End With
End Sub
 
Misschien ten overvloede.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim nieuw As String
 If Not Intersect(Target, Cells.SpecialCells(-4174)) Is Nothing Then
  With Application
    .EnableEvents = False
    nieuw = Target
    .Undo
  Target = IIf(nieuw = "", "", IIf(InStr(Target, nieuw) > 0, Target, IIf(Target = "", nieuw, Target & "," & nieuw)))
 .EnableEvents = True
  End With
End If
End Sub
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan