Skip i'r prif gynnwys

Sut i ddewis nifer o eitemau o'r gwymplen i mewn i gell yn Excel?

Defnyddir y gwymplen yn aml yng ngwaith dyddiol Excel. Yn ddiofyn, dim ond un eitem y gellir ei dewis mewn rhestr ostwng. Ond mewn rhai adegau, efallai y bydd angen i chi ddewis nifer o eitemau o'r rhestr ostwng i mewn i un gell fel y nodir isod. Sut allwch chi ei drin yn Excel?

doc dewis nifer o eitemau o'r gwymplen 1 saeth doc dde doc dewis nifer o eitemau o'r gwymplen 2

Dewiswch nifer o eitemau o'r gwymplen i mewn i gell gyda VBA

Dewiswch eitemau lluosog o'r gwymplen i mewn i gell yn hawdd ac yn gyflym


Dewiswch nifer o eitemau o'r gwymplen i mewn i gell gyda VBA

Dyma rai y gall VBA eich gwneud yn ffafriol wrth ddatrys y swydd hon.

Dewiswch eitemau dyblyg o'r gwymplen mewn cell

1. Ar ôl creu rhestr ostwng, cliciwch ar y dde wrth y tab dalen i ddewis Gweld y Cod o'r ddewislen cyd-destun.
doc dewis nifer o eitemau o'r gwymplen 3

2. Yna yn y Microsoft Visual Basic ar gyfer Ceisiadau ffenestr, copïo a gludo islaw'r cod i'r sgript wag.

VBA: Dewiswch nifer o eitemau o'r gwymplen mewn cell

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. Cadwch y cod a chau'r ffenestr i fynd yn ôl i'r gwymplen. Nawr gallwch ddewis nifer o eitemau o'r gwymplen.

Nodyn:

1. Gyda'r VBA, mae'n gwahanu'r eitemau yn ôl gofod, gallwch chi newid xStrNew = xStrNew & "" & Target.Value i eraill newid y amffinydd yn ôl yr angen. Er enghraifft, xStrNew = xStrNew & "," & Target.Value yn gwahanu'r eitemau gyda choma.

2. Mae'r cod VBA hwn yn gweithio ar gyfer pob rhestr ostwng yn y ddalen.

Dewiswch nifer o eitemau o'r gwymplen i gell heb eu hailadrodd

Os ydych chi am ddewis eitemau unigryw o'r gwymplen i gell, gallwch ailadrodd uwchben y camau a defnyddio isod y cod.

VBA : Dewiswch nifer o eitemau o'r gwymplen i gell heb eu hailadrodd

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

Nid yw'r ddau god VBA uchod yn suppot i ddileu rhannau o gynnwys celloedd, dim ond cefnogaeth i glirio pob eitem o'r gell.


Dewiswch eitemau lluosog o'r gwymplen i mewn i gell yn hawdd ac yn gyflym

Yn Excel, ac eithrio cod VBA, nid oes unrhyw ffyrdd eraill o ganiatáu eitemau lluosog a ddewiswyd o'r gwymplen mewn cell. Fodd bynnag, mae'r Rhestr Gollwng Aml-ddewis nodwedd o Kutools ar gyfer Excel yn gallu trin y swydd hon yn gyflym ac yn hawdd gyda chliciau.

Tip: Cyn cymhwyso'r offeryn hwn, gosodwch Kutools ar gyfer Excel yn gyntaf. Ewch i lawrlwytho am ddim nawr.
Cam 1: Dewiswch Kutools > Rhestr Gollwng > Rhestr Gollwng Aml-ddewis
Cam 2: Yn y Rhestr Gollwng Aml-ddethol deialog, nodwch y gosodiadau
  1. Gosod cwmpas;
  2. Nodwch y gwahanydd ar gyfer eitemau amffinio mewn cell;
  3. Penderfynwch ar gyfeiriad y testun;
  4. Cliciwch OK.
    doc dewiswch eitemau lluosog o'r gwymplen kte 1
Canlyniad:

dewiswch eitemau lluosog o kutools rhestr ostwng

Nodyn: Ar gyfer defnyddio nodwedd Rhestr Gollwng Aml-ddethol, dylech osod Kutools ar gyfer Excel yn gyntaf, os gwelwch yn dda cliciwch i lawrlwytho a chael treial am ddim 30 diwrnod nawr.

Hawdd creu rhestr ostwng ddibynnol ddeinamig 2-lefel neu aml-lefel yn Excel

Yn Excel, mae creu rhestr ostwng 2 lefel neu luosog yn gymhleth. Yma mae'r Rhestr Gollwng Dynamig cyfleustodau Kutools ar gyfer Excel yn gallu gwneud ffafr i chi. Yr hyn y mae'n rhaid i chi ei wneud yn unig yw archebu'r data fel yr enghraifft a ddangosir, yna dewiswch yr ystod ddata a'r ystod allbwn, yna ei adael i'r cyfleustodau.  Cliciwch am 30 diwrnod o dreial am ddim!
doc datblygedig cyfuno rhesi
 
Kutools ar gyfer Excel: gyda mwy na 300 o ychwanegion Excel defnyddiol, am ddim i geisio heb unrhyw gyfyngiad mewn 30 diwrnod.

Offer Cynhyrchiant Swyddfa Gorau

🤖 Kutools AI Aide: Chwyldro dadansoddi data yn seiliedig ar: Cyflawniad Deallus   |  Cynhyrchu Cod  |  Creu Fformiwlâu Personol  |  Dadansoddi Data a Chynhyrchu Siartiau  |  Invoke Swyddogaethau Kutools...
Nodweddion Poblogaidd: Darganfod, Amlygu neu Adnabod Dyblygiadau   |  Dileu Rhesi Gwag   |  Cyfuno Colofnau neu Gelloedd heb Colli Data   |   Rownd heb Fformiwla ...
Super-edrych: VLookup Meini Prawf Lluosog    VLookup Gwerth Lluosog  |   VLookup Ar Draws Taflenni Lluosog   |   Edrych Niwlog ....
Rhestr gwympo Uwch: Creu Rhestr Gollwng yn Gyflym   |  Rhestr Gollwng Dibynnol   |  Rhestr Gollwng Aml-ddewis ....
Rheolwr Colofn: Ychwanegu Nifer Penodol o Golofnau  |  Symud Colofnau  |  Toglo Statws Gwelededd Colofnau Cudd  |  Cymharwch Ystodau a Cholofnau ...
Nodweddion dan Sylw: Ffocws ar y Grid   |  Golwg Dylunio   |   Bar Fformiwla Mawr    Rheolwr Llyfr Gwaith a Thaflen   |  Llyfrgell Adnoddau (Testun Auto)   |  Dewiswr Dyddiad   |  Cyfuno Taflenni Gwaith   |  Amgryptio/Dadgryptio Celloedd    Anfon E-byst trwy Restr   |  Hidlo Super   |   Hidlo Arbennig (hidlo mewn print trwm/italig/strikethrough...) ...
15 Set Offer Gorau12 Testun offer (Ychwanegu Testun, Dileu Cymeriadau,...)   |   50 + Siart Mathau (Siart Gantt,...)   |   40+ Ymarferol Fformiwlâu (Cyfrifwch oedran yn seiliedig ar ben-blwydd,...)   |   19 mewnosod offer (Mewnosod Cod QR, Mewnosod Llun o'r Llwybr,...)   |   12 Trosi offer (Rhifau i Eiriau, Trosi arian cyfred,...)   |   7 Uno a Hollti offer (Rhesi Cyfuno Uwch, Celloedd Hollt,...)   |   ... a mwy

Supercharge Eich Sgiliau Excel gyda Kutools ar gyfer Excel, a Phrofiad Effeithlonrwydd Fel Erioed Erioed. Kutools ar gyfer Excel Yn Cynnig Dros 300 o Nodweddion Uwch i Hybu Cynhyrchiant ac Arbed Amser.  Cliciwch Yma i Gael Y Nodwedd Sydd Ei Angen Y Mwyaf...

Disgrifiad


Mae Office Tab yn dod â rhyngwyneb Tabbed i Office, ac yn Gwneud Eich Gwaith yn Haws o lawer

  • Galluogi golygu a darllen tabbed yn Word, Excel, PowerPoint, Cyhoeddwr, Mynediad, Visio a Phrosiect.
  • Agor a chreu dogfennau lluosog mewn tabiau newydd o'r un ffenestr, yn hytrach nag mewn ffenestri newydd.
  • Yn cynyddu eich cynhyrchiant 50%, ac yn lleihau cannoedd o gliciau llygoden i chi bob dydd!
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