メインコンテンツへスキップ

ドロップダウンリストからExcelのセルに複数のアイテムを選択するにはどうすればよいですか?

ドロップダウンリストは、Excelの日常業務で頻繁に使用されます。 デフォルトでは、ドロップダウンリストで選択できる項目はXNUMXつだけです。 ただし、以下のスクリーンショットに示すように、ドロップダウンリストから複数のアイテムをXNUMXつのセルに選択する必要がある場合があります。 Excelでどのように処理できますか?

ドロップダウンリストから複数のアイテムを選択するドキュメント1 右矢印ドキュメント ドロップダウンリストから複数のアイテムを選択するドキュメント2

ドロップダウンリストからVBAを使用してセルに複数のアイテムを選択します

ドロップダウン リストからセルに複数の項目を簡単かつ迅速に選択します。


ドロップダウンリストからVBAを使用してセルに複数のアイテムを選択します

ここに、この仕事を解決する上であなたに有利なVBAがいくつかあります。

セルのドロップダウンリストから重複するアイテムを選択します

1.ドロップダウンリストを作成したら、シートタブを右クリックして選択します コードを表示 コンテキストメニューから選択します。
ドロップダウンリストから複数のアイテムを選択するドキュメント3

2.次に、 アプリケーション向け Microsoft Visual Basic ウィンドウで、以下のコードをコピーして空白のスクリプトに貼り付けます。

VBA:セルのドロップダウンリストから複数のアイテムを選択します

Private Sub Worksheet_Change(ByVal Target As Range)
'UpdatebyExtendoffice20221111
    Dim xRgVal As Range
    Dim xStrNew As String
    On Error Resume Next
    Set xRgVal = Cells.SpecialCells(xlCellTypeAllValidation)
    If (Target.Count > 1) Or (xRgVal Is Nothing) Then Exit Sub
    If Intersect(Target, xRgVal) Is Nothing Then Exit Sub
    If Target.Value = "" Then Exit Sub
    Application.EnableEvents = False
    xStrNew = Target.Value
    Application.Undo
    If xStrNew = Target.Value Then
    Else
    xStrNew = xStrNew & " " & Target.Value
    Target.Value = xStrNew
    End If
    Application.EnableEvents = True
End Sub

3.コードを保存し、ウィンドウを閉じてドロップダウンリストに戻ります。 これで、ドロップダウンリストから複数のアイテムを選択できます。

注意:

1. VBAを使用すると、アイテムがスペースで区切られ、変更できます xStrNew = xStrNew& "" &Target.Value 必要に応じて区切り文字を変更するために他の人に。 例えば、 xStrNew = xStrNew& "、" &Target.Value 項目はコンマで区切ります。

2.このVBAコードは、シート内のすべてのドロップダウンリストで機能します。

ドロップダウンリストからセルに繰り返しなしで複数のアイテムを選択します

ドロップダウンリストからセルに一意のアイテムを選択するだけの場合は、上記の手順を繰り返して、以下のコードを使用できます。

VBA:ドロップダウンリストからセルに複数のアイテムを繰り返し選択する

Private Sub Worksheet_Change(ByVal Target As Range)
'UpdatebyExtendoffice20221111
    Dim I As Integer
    Dim xRgVal As Range
    Dim xStrNew As String
    Dim xStrOld As String
    Dim xFlag As Boolean
    Dim xArr
    On Error Resume Next
    Set xRgVal = Cells.SpecialCells(xlCellTypeAllValidation)
    If (Target.Count > 1) Or (xRgVal Is Nothing) Then Exit Sub
    If Intersect(Target, xRgVal) Is Nothing Then Exit Sub
    If Target.Value = "" Then Exit Sub
    Application.EnableEvents = False
    xFlag = True
    xStrNew = " " & Target.Value & " "
    Application.Undo
    xStrOld = Target.Value
    If InStr(1, xStrOld, xStrNew) = 0 Then
        xStrNew = xStrNew & xStrOld & " "
    Else
        xStrNew = xStrOld
    End If
    Target.Value = xStrNew
    Application.EnableEvents = True
End Sub

上記の VBA コードは両方とも、セルの内容の一部を削除することをサポートしていません。セルのすべての項目をクリアすることのみをサポートしています。


ドロップダウン リストからセルに複数の項目を簡単かつ迅速に選択します。

Excel では、VBA コードを除いて、セル内のドロップダウン リストから複数の項目を選択できるようにする他の方法はありません。 しかし 複数選択ドロップダウンリスト の特徴 Kutools for Excel クリックするだけで、このジョブをすばやく簡単に処理できます。

先端: このツールを適用する前に、まず Kutools for Excel をインストールしてください。 今すぐ無料ダウンロードへ.
ステップ1: クツールを選択 > ドロップダウンリスト > 複数選択ドロップダウンリスト
ステップ 2: [複数選択ドロップダウン リスト] ダイアログで、設定を指定します。
  1. 範囲を設定します。
  2. セル内の区切り項目のセパレーターを指定します。
  3. 文字の向きを決める;
  4. [OK]をクリックします。
    doc ドロップダウン リストから複数の項目を選択 kte 1
結果:

ドロップダウンリストから複数のアイテムを選択するkutools

Note: 複数選択ドロップダウン リスト機能を使用するには、まず Excel 用 Kutools をインストールする必要があります。 クリックしてダウンロードし、今すぐ 30 日間の無料トライアルをお試しください.

Excelで動的な2レベルまたは複数レベルの依存ドロップダウンリストを簡単に作成

Excelでは、2レベルまたは複数レベルのドロップダウンリストを作成するのは複雑です。 ここに 動的ドロップダウンリスト の有用性 Kutools for Excel あなたに恩恵を与えることができます。 表示されている例のようにデータを注文し、データ範囲と出力範囲を選択して、ユーティリティに任せるだけです。  30日間の無料トライアルをクリックしてください!
docAdvanced結合行
 
Kutools for Excel:300を超える便利なExcelアドインがあり、30日以内に制限なしで無料で試すことができます。

最高のオフィス生産性向上ツール

🤖 Kutools AI アシスタント: 以下に基づいてデータ分析に革命をもたらします。 インテリジェントな実行   |  コードを生成  |  カスタム数式の作成  |  データを分析してグラフを生成する  |  Kutools関数を呼び出す...
人気の機能: 重複を検索、強調表示、または識別する   |  空白行を削除する   |  データを失わずに列またはセルを結合する   |   数式なしのラウンド ...
スーパールックアップ: 複数の基準の VLookup    複数の値の VLookup  |   複数のシートにわたる VLookup   |   ファジールックアップ ....
詳細ドロップダウン リスト: ドロップダウンリストを素早く作成する   |  依存関係のドロップダウン リスト   |  複数選択のドロップダウンリスト ....
列マネージャー: 特定の数の列を追加する  |  列の移動  |  Toggle 非表示列の表示ステータス  |  範囲と列の比較 ...
注目の機能: グリッドフォーカス   |  デザインビュー   |   ビッグフォーミュラバー    ワークブックとシートマネージャー   |  リソースライブラリ (自動テキスト)   |  日付ピッカー   |  ワークシートを組み合わせる   |  セルの暗号化/復号化    リストごとにメールを送信する   |  スーパーフィルター   |   特殊フィルター (太字/斜体/取り消し線をフィルター...) ...
上位 15 のツールセット12 テキスト ツール (テキストを追加, 文字を削除する、...)   |   50+ チャート 種類 (ガントチャート、...)   |   40+ 実用的 (誕生日に基づいて年齢を計算する、...)   |   19 挿入 ツール (QRコードを挿入, パスから画像を挿入、...)   |   12 変換 ツール (数字から言葉へ, 通貨の換算、...)   |   7 マージ&スプリット ツール (高度な結合行, 分割セル、...)   |   ... もっと

Kutools for Excel で Excel スキルを強化し、これまでにない効率を体験してください。 Kutools for Excelは、生産性を向上させ、時間を節約するための300以上の高度な機能を提供します。  最も必要な機能を入手するにはここをクリックしてください...

説明


Officeタブは、タブ付きのインターフェイスをOfficeにもたらし、作​​業をはるかに簡単にします

  • Word、Excel、PowerPointでタブ付きの編集と読み取りを有効にする、パブリッシャー、アクセス、Visioおよびプロジェクト。
  • 新しいウィンドウではなく、同じウィンドウの新しいタブで複数のドキュメントを開いて作成します。
  • 生産性を 50% 向上させ、毎日何百回もマウス クリックを減らすことができます!
Comments (26)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Como posso utilizar a função com a planilha bloqueada?
This comment was minimized by the moderator on the site
Hi, Macros, try below code, it supports to select multi items in drop down list in protected sheet.
Private Sub Worksheet_Change(ByVal Target As Range)
'UpdatebyExtendoffice20221111
    Dim xRgVal As Range
    Dim xStrNew As String
    On Error Resume Next  
    xType = 0
    xType = Target.Validation.Type
    If xType <> 3 Then Exit Sub
    If (Target.Count > 1) Then Exit Sub

    If Target.Value = "" Then Exit Sub
    Application.EnableEvents = False
    xStrNew = Target.Value
    Application.Undo
    If xStrNew = Target.Value Then
    Else
    xStrNew = xStrNew & " " & Target.Value
    Target.Value = xStrNew
    End If
    Application.EnableEvents = True
End Sub

And also Kutools for Excel 26.1 and later versions supports this job in protected sheet.
This comment was minimized by the moderator on the site
¿Cómo puedo hacer para que el orden en que se coloque el texto, sea tan cuál como yo quiera?

Ejemplo:
Mi texto para la lista es:
TRAMITAR ESTE ASUNTO
COORDINAR
ANALIZAR Y RECOMENDAR

sí selecciono:
TRAMITAR ESTE ASUNTO
ANALIZAR Y RECOMENDAR

me aparece
ANALIZAR Y RECOMENDAR, TRAMITAR ESTE ASUNTO

o sea, los de abajo me aparecen primero, pero quiero que sea en el orden en que voy seleccionando...
TRAMITAR ESTE ASUNTO, ANALIZAR Y RECOMENDAR.....
This comment was minimized by the moderator on the site
Hi, Gorgelys, Kutools's multi-select drop down list can help you. The items you selected will be in the order like you want.
This comment was minimized by the moderator on the site
the code works but won't let me delete can someone please post the new code.
This comment was minimized by the moderator on the site
bonjour,
selon le premier exemple tout fonctionne très bien jusqu'à ce que je verrouille la feuille.
quand la feuille est verrouillée, je n'ai plus le choix multiple !
comment faire ?
merci par avance
This comment was minimized by the moderator on the site
Hi, sorry for that. We will upgrade our feature next version to avoid this problem. Thank you for your feekback.
This comment was minimized by the moderator on the site
Merci bcp
Mais à quand la nouvelle version ?
This comment was minimized by the moderator on the site
Hi, we have updated this version for you, but this is a beta version, please download it from this: https://download.extendoffice.com/downloads/Kutools-for-Excel/beta/26.10/KutoolsforExcelSetup.Inno.exe
If there are any problems, welcome for your feedback.
This comment was minimized by the moderator on the site
Merci,
Je vais la télécharger et essayer.
Bonne journée
This comment was minimized by the moderator on the site
Hi, the new version is in planning, since next version will upgrade multiple features, it may take somewhat time.
This comment was minimized by the moderator on the site
Hi! Como puedo usar este codigo para todo un worksheet y no solo para una pestana?
This comment was minimized by the moderator on the site
Hi, Vero, Kutools for Excel's Multi-select Drop-down List feature suports selecting multiple items from drop down list in the whole worksheet or across workbook, just specify the Specified Scope in the Multi-select Drop-down List Settings dialog.
This comment was minimized by the moderator on the site
How can I do that for the fist formula you provided :) Thanks in advanced!
This comment was minimized by the moderator on the site
Quando quero deletar alguma opção ou todas dá erro. Como posso resolver?
This comment was minimized by the moderator on the site
I am also finding that after selecting multiple items using the updated VBA code, I still cannot clear the cell, it just keeps multiplying.
Does anyone have a solution for this yet?
This comment was minimized by the moderator on the site
Hi, Rusty, the code I have updated for making it more stable. But because the cell is in data validation, blank is out of data validation, the code cannot solve this problem.
This comment was minimized by the moderator on the site
the code works but carries over across all cells and multiplies in the cells and wont allow delete can you assist?
This comment was minimized by the moderator on the site
If I create a sheet with dropdown list using checkboxes, is there a way to share this workbook with this checkboxes feature?
This comment was minimized by the moderator on the site
How would you apply this functionality but making it so that there aren't redundant values? Any help would be appreciated!
This comment was minimized by the moderator on the site
I used this "Select multiple items from drop down list to a cell without repeat"
this is what happened
1. Multiple selections happen without problems.
2. The issue is when i try to edit and remove an option. There is no way for me to remove an option. it keeps multiplying.
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations