Skip to main content

Conas a bheith autocomplete agus tú ag clóscríobh liosta anuas Excel?

Le haghaidh liosta anuas bailíochtaithe sonraí a bhfuil go leor míreanna ann, ní mór duit scrollaigh suas agus síos sa liosta chun an ceann atá uait a fháil nó an focal iomlán a chlóscríobh isteach sa bhosca liosta i gceart. An bhfuil aon bhealach chun an liosta anuas a chur i gcrích go huathoibríoch agus na carachtair chomhfhreagracha á gclóscríobh? Chuideodh sé seo le daoine oibriú ar bhealach níos éifeachtaí ar bhileoga oibre le liostaí anuas i gcealla. Soláthraíonn an teagaisc seo dhá mhodh chun cabhrú leat é a bhaint amach.

Déan liostaí anuas a bheith uathchríochnaithe le cód VBA
Go héasca déan liostaí anuas a uathchríochnú i 2 soicind

Tuilleadh ranganna teagaisc don liosta anuas ...


Déan liostaí anuas a bheith uathchríochnaithe le cód VBA

Déan mar a leanas le do thoil chun liosta anuas a dhéanamh uathchomhbhrúite tar éis litreacha comhfhreagracha a chlóscríobh sa chill.

Ar dtús, ní mór duit bosca teaglama a chur isteach sa bhileog oibre agus a airíonna a athrú.

1. Oscail an bhileog oibre ina bhfuil na cealla liosta anuas ar mhaith leat iad a dhéanamh uathchríochnaithe.

2. Sula gcuirfidh tú bosca Teaglama isteach, ní mór duit an cluaisín Forbróra a chur leis an ribín Excel. Má tá an cluaisín Forbróra á thaispeáint ar do ribín, aistrigh go céim 3. Seachas sin, déan mar seo a leanas chun an cluaisín Forbróir a thaispeáint suas sa ribín: Cliceáil Comhad > Roghanna a oscailt Roghanna fuinneog. Sa mhéid seo Roghanna Excel fuinneog, cliceáil Saincheap an Ribbon sa phána chlé, seiceáil an Forbróir bosca, agus ansin cliceáil ar an OK cnaipe. Féach an pictiúr:

3. cliceáil Forbróir > Ionsáigh > Bosca Teaglama (Rialú ActiveX).

4. Tarraing bosca teaglama sa bhileog oibre reatha. Cliceáil ar dheis air agus ansin roghnaigh Airíonna ón roghchlár cliceáil ar dheis.

5. Sa Airíonna bosca dialóige, cuir an téacs bunaidh sa bhosca le do thoil (Ainm) réimse le TempComb.

6. Múch an Mód Dearaidh trí chliceáil Forbróir > Mód Dearaidh.

Ansin, cuir an cód VBA thíos i bhfeidhm

7. Cliceáil ar dheis ar an táb reatha bileog agus cliceáil Féach an cód ón roghchlár comhthéacs. Féach an pictiúr:

8. San oscailt Microsoft Visual Basic d’Fheidhmchláir fuinneog, cóipeáil agus greamaigh an cód VBA thíos i bhfuinneog Chód na bileoige oibre.

Cód VBA: Autocomplete agus an liosta anuas á chlóscríobh

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'Update by Extendoffice: 2020/01/16
    Dim xCombox As OLEObject
    Dim xStr As String
    Dim xWs As Worksheet
    Dim xArr
    
    Set xWs = Application.ActiveSheet
    On Error Resume Next
    Set xCombox = xWs.OLEObjects("TempCombo")
    With xCombox
        .ListFillRange = ""
        .LinkedCell = ""
        .Visible = False
    End With
    If Target.Validation.Type = 3 Then
        Target.Validation.InCellDropdown = False
        Cancel = True
        xStr = Target.Validation.Formula1
        xStr = Right(xStr, Len(xStr) - 1)
        If xStr = "" Then Exit Sub
        With xCombox
            .Visible = True
            .Left = Target.Left
            .Top = Target.Top
            .Width = Target.Width + 5
            .Height = Target.Height + 5
            .ListFillRange = xStr
            If .ListFillRange = "" Then
                xArr = Split(xStr, ",")
                Me.TempCombo.List = xArr
            End If
            .LinkedCell = Target.Address
        End With
        xCombox.Activate
        Me.TempCombo.DropDown
    End If
End Sub
Private Sub TempCombo_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
    Select Case KeyCode
        Case 9
            Application.ActiveCell.Offset(0, 1).Activate
        Case 13
            Application.ActiveCell.Offset(1, 0).Activate
    End Select
End Sub

9. Brúigh Eile + Q eochracha ag an am céanna chun an Feidhmchláir Bhunúsacha Amharc Microsoft fhuinneog.

As seo amach, nuair a chliceálann tú ar chill liosta anuas, spreagfaidh an liosta anuas go huathoibríoch. Is féidir leat tosú ag clóscríobh na litreach chun go mbeidh an earra comhfhreagrach comhlánaithe go huathoibríoch i gcill roghnaithe. Féach an pictiúr:

Nóta: Ní oibríonn an cód seo do chealla cumaiscthe.


Go héasca déan liosta anuas a uathchríochnú i 2 soicind

Don chuid is mó d'úsáideoirí Excel, tá sé deacair an modh VBA thuas a mháistir. Ach leis an Liosta anuas Inchuardaithe gné de Kutools le haghaidh Excel, is féidir leat uathchríochnú a chumasú go héasca le haghaidh liostaí anuas bailíochtaithe sonraí i raon, an bileog oibre reatha, an leabhar oibre reatha or bileog oibre ar leith mar is gá duit i díreach 2 soicind. Ina theannta sin, tá an ghné seo ar fáil do gach leagan Excel.

Leid: Sula gcuirfidh tú an uirlis seo i bhfeidhm, suiteáil le do thoil Kutools le haghaidh Excel ar dtús. Téigh go dtína íoslódáil saor in aisce anois.

  1. Roghnaigh Kutools > Liosta anuas > Liosta anuas Inchuardaithe.
  2. sa Liosta anuas Inchuardaithe bosca dialóige, sonraigh an áit ar mhaith leat an ghné seo a chur i bhfeidhm sa Socraigh raon feidhme alt, agus ansin cliceáil OK na socruithe a shábháil.
Toradh

Nuair a bheidh sé cumraithe, gheobhaidh tú bosca liosta suas ach cliceáil ar chill liosta anuas laistigh den raon sonraithe. Nuair a chlóscríobhann tú carachtair, a luaithe is a mheaitseálann mír amháin go beacht, beidh an focal iomlán uathchríochnaithe.

nótaí: Chun an ghné seo a chur i bhfeidhm, le do thoil Íoslódáil agus a shuiteáil Kutools do Excel an chéad.

Earraí gaolmhara:

Conas liosta anuas a chruthú le ticbhoscaí iolracha in Excel?
Is iondúil go gcruthóidh a lán úsáideoirí Excel liosta anuas le ilbhoscaí seiceála d’fhonn míreanna éagsúla a roghnú ón liosta in aghaidh na huaire. I ndáiríre, ní féidir leat liosta a chruthú le ilbhoscaí seiceála le Bailíochtú Sonraí. Sa rang teagaisc seo, táimid chun dhá mhodh a thaispeáint duit chun liosta anuas a chruthú le ticbhoscaí iolracha in Excel. Soláthraíonn an teagaisc seo an modh chun an fhadhb a réiteach.

Cruthaigh liosta anuas ó leabhar oibre eile in Excel
Tá sé furasta go leor liosta anuas bailíochtaithe sonraí a chruthú i measc bileoga oibre i leabhar oibre. Ach má aimsíonn na sonraí liosta atá uait le haghaidh bailíochtú na sonraí i leabhar oibre eile, cad a dhéanfá? Sa rang teagaisc seo, foghlaimeoidh tú conas liosta titim anuas a chruthú ó leabhar oibre eile in Excel go mion.

Cruthaigh liosta anuas inchuardaithe in Excel
Maidir le liosta anuas le go leor luachanna, ní obair éasca é ceann ceart a aimsiú. Roimhe seo thugamar isteach modh chun an liosta anuas a chomhlánú go huathoibríoch nuair a chuireann tú an chéad litir isteach sa bhosca anuas. Chomh maith leis an bhfeidhm uathchomhiomlán, is féidir leat an liosta anuas a chuardach chun an éifeachtúlacht oibre a fheabhsú chun luachanna cearta a fháil ar an liosta anuas. Chun an liosta anuas a chuardach inchuardaithe, bain triail as an modh sa rang teagaisc seo.

Déan cealla eile a uathoibriú nuair a bhíonn luachanna á roghnú agat ar liosta anuas Excel
Ligean le rá gur chruthaigh tú liosta anuas bunaithe ar na luachanna i raon cille B8: B14. Nuair a roghnaíonn tú luach ar bith ar an liosta anuas, ba mhaith leat go ndéanfaí na luachanna comhfhreagracha i raon cille C8: C14 a dhaonra go huathoibríoch i gcill roghnaithe. Chun an fhadhb a réiteach, is fearr leat na modhanna sa rang teagaisc seo.

Tuilleadh ranganna teagaisc don liosta anuas ...

Uirlisí Táirgiúlachta Oifige is Fearr

🤖 Kutools AI Aide: anailís sonraí a réabhlóidiú bunaithe ar: Forghníomhú Chliste   |  Gin Cód  |  Cruthaigh Foirmlí Saincheaptha  |  Anailís a dhéanamh ar Sonraí agus Cairteacha a Ghin  |  Feidhmeanna Kutools a agairt...
Gnéithe Coitianta: Faigh, Aibhsigh nó Aithnigh Dúblaigh   |  Scrios Sraitheanna Bána   |  Comhcheangail Colúin nó Cealla gan Sonraí a Chailleadh   |   Babhta gan Foirmle ...
Cuardaigh Super: Ilchritéir VLookup    VLookup Illuachanna  |   VLookup Trasna Ilbhileoga   |   Amharc doiléir ....
Liosta anuas Casta: Go tapa Cruthaigh Liosta Anuas   |  Liosta anuas Cleithiúnach   |  Liosta Buail Isteach Ilroghnacha ....
Bainisteoir Colún: Cuir Líon Sonrach Colún leis  |  Colúin Bog  |  Scoránaigh Stádas Infheictheachta na gColún Ceilte  |  Déan comparáid idir Raonta & Colúin ...
Gnéithe Réadmhaoin: Fócas Eangaí   |  Amharc Dearaidh   |   Barra Mór na Foirmle    Leabhar Oibre & Bainisteoir Bileog   |  Leabharlann Acmhainní (Uaththéacs)   |  Piocálaí Dáta   |  Comhcheangail Bileoga Oibre   |  Criptigh/Díchriptigh Cealla    Seol Ríomhphost trí Liosta   |  Scagaire Super   |   Scagaire Speisialta (scagaire trom/iodálach/stailc tríd...) ...
Barr 15 Uirlisí12 Téacs uirlisí (Cuir Téacs, Bain Carachtair,...)   |   50 + Cairt cineálacha (Cairt Gantt,...)   |   40+ Praiticiúil Foirmlí (Ríomh aois bunaithe ar lá breithe,...)   |   19 Insertion uirlisí (Cuir isteach Cód QR, Ionsáigh Pictiúr ón gCosán,...)   |   12 Tiontú uirlisí (Uimhreacha le Focail, Comhshó Airgeadra,...)   |   7 Cumaisc & Scoilt uirlisí (Sraitheanna Comhcheangail Casta, Cealla Scoilt,...)   |   ... agus eile

Supercharge Do Scileanna Excel le Kutools le haghaidh Excel, agus Éifeachtúlacht Taithí Cosúil Ná Roimhe. Kutools le haghaidh Excel Tairiscintí Níos mó ná 300 Ardghnéithe chun Táirgiúlacht a Treisiú agus Sábháil Am.  Cliceáil anseo chun an ghné is mó a theastaíonn uait a fháil ...

Tuairisc


Tugann Tab Oifige comhéadan Tabbed chuig Office, agus Déan Do Obair i bhfad Níos Éasca

  • Cumasaigh eagarthóireacht agus léamh tabbed i Word, Excel, PowerPoint, Foilsitheoir, Rochtain, Visio agus Tionscadal.
  • Oscail agus cruthaigh cáipéisí iolracha i gcluaisíní nua den fhuinneog chéanna, seachas i bhfuinneoga nua.
  • Méadaíonn do tháirgiúlacht 50%, agus laghdaíonn sé na céadta cad a tharlaíonn nuair luch duit gach lá!
Comments (325)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Hi, many thanks for this material. It helped a lot.
This comment was minimized by the moderator on the site
Hello,

following on from my last comment:

I'm setting up 'standard' rows with the dropdown lists in them. These I'm wanting to copy below into an extensive spreadsheet.
Unfortunately the dropdown's don't copy down when I do that after using the VBA.
Is there a way to do whats described above?

Cheers,
Catherine
This comment was minimized by the moderator on the site
Hi Catherine,
The autocomplete drop-down lists generated by VBA code cannot be copied. You can only copy selected items that are displayed in the drop-down cell. Sorry for the inconvenience.
This comment was minimized by the moderator on the site
Hello,

Have implemented this successfully, so thank you for this page and code.
But now I have an associated problem...:

After doing all of the above points, the code works as described, but I cannot do any undo/redo actions in the entire spreadsheet.
Is there a way to turn this combo box on for when I want to work with the dropdowns and off for when I want to work in other cells? so that the undo/redo actions are possible again?
and note, yes I have turned the design mode off after doing the above steps, but it still doesn't help the problem.

Cheers,
Catherine
This comment was minimized by the moderator on the site
Hi Catherine Foley,
If you want to use the undo operation on cells other than the drop-down cells, the following VBA code can help you. Please give it a try.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'Update by Extendoffice: 2022/09/22
    Dim xCombox As OLEObject
    Dim xStr As String
    Dim xWs As Worksheet
    Dim xArr
    
    On Error Resume Next

    Set xWs = Application.ActiveSheet
    
    Set xCombox = xWs.OLEObjects("TempCombo")
    If Target.Validation.Type <> 3 Then
        If xCombox.Visible Then
            xCombox.Visible = False
        End If
        Exit Sub
    End If
    
    With xCombox
        .ListFillRange = ""
        .LinkedCell = ""
'        .Visible = False
    End With

    Target.Validation.InCellDropdown = False
    Cancel = True
    xStr = Target.Validation.Formula1
    xStr = Right(xStr, Len(xStr) - 1)
    If xStr = "" Then Exit Sub
    With xCombox
        .Visible = True
        .Left = Target.Left
        .Top = Target.Top
        .Width = Target.Width + 5
        .Height = Target.Height + 5
        .ListFillRange = xStr
        If .ListFillRange = "" Then
            xArr = Split(xStr, ",")
            Me.TempCombo.List = xArr
        End If
        .LinkedCell = Target.Address
    End With
    xCombox.Activate
    Me.TempCombo.DropDown

End Sub
Private Sub TempCombo_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
    Select Case KeyCode
        Case 9
            Application.ActiveCell.Offset(0, 1).Activate
        Case 13
            Application.ActiveCell.Offset(1, 0).Activate
    End Select
End Sub
This comment was minimized by the moderator on the site
I hope now it will be upload
This comment was minimized by the moderator on the site
This code works really well for a single drop down. However, if I have 5 dropdowns using the same list of values but they need to operate independently of each other how is that accomplished? Despite my best efforts, if I put more than one combo box on the page, any selection is one is mirrored in the other.
This comment was minimized by the moderator on the site
Hi Mbuchmeier,Only need one combo box on the page. The code works on all drop-down lists in current page. You just need to manually click on the drop-down list cell to activate the combo box.
This comment was minimized by the moderator on the site
Hi crystal,
I am working with the combo box (The VBA code from 2021/11/05). It is working great and very useful but there are 2 issues:1. Issue #1: Usually when you work on any cell in Excel, there is indication on the row number which indicate which row you work about. When the combo box is opened this indication is missing2.  Issue #2: When the combo box is opened in the last column of the dynamic table, then it isn't  working as usual: when I select value from the list, the cell remain empty until I move the cursor to another cell
Attached screenshot.
Thank in advance
This comment was minimized by the moderator on the site
Hi Yoni,Thanks for your feedback. For the issues you mentioned:1. Issue #1: Excel does not highlight the row number when selecting an object in the worksheet. Since we use a combo box to replace the data validation drop-down list to handle the autocomplete operation, we can't show the indication in this case;2. Issue #2: I have tried as you described, but the problem cannot be reproduced. The screenshot you attached does not display, you need to save the screenshot and uplode it via the "Upload files" button below.
This comment was minimized by the moderator on the site
Hi Crystal,Thanks a lot for your response. Attached the screenshot. hope it will work now
This comment was minimized by the moderator on the site
Hi Yoni,Sorry for the inconvenience. The screenshot you uploaded is still not shown on the page. You need to save the screenshot on your disk in advance and then uplode it via the "Upload files" button. See the attached screenshot.
This comment was minimized by the moderator on the site
will, thank you is not enugh :::: alot of thank you then ;;;;; that worked like magic :)
This comment was minimized by the moderator on the site
Yeah, basically completely useless.  Want the cell to auto-complete when typing in a cell using list data validation.Tried this, and now I have to start over from scratch because I can't Undo it.  Thanks.Also loaded with syntax errors.
This comment was minimized by the moderator on the site
It works as it should be except for two things, first, there is no validation after insertion. i.e. if I typed anything at the combo then clicked enter it will accept the typed value while it should not do this since the data validation is being used to prevent such behaviors and make sure that the entered data is from selected range. Second, at the data validation list, sometimes I use big range with empty cells and select ignore empty at validation list but the combo takes all the range and shows it, will be nice to remove the empty cells from the combo range.
Thanks & hope you can implement these things to make it perfect.
This comment was minimized by the moderator on the site
Hi, AhmedThe VBA below helps to solve the problem of blank cells. Since the Combo box accepts the value that are not in the list, we still can't find a way to solve this problem. Sorry for the inconvenience.
<div data-tag="code">Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'Update by Extendoffice: 2021/11/05
Dim xCombox As OLEObject
Dim xStr As String
Dim xWs As Worksheet
Dim xArr, xArr1
Dim xRg As Range
Dim xSrc As Variant
Dim xI, xJ, xIndex, xCount As Integer

Set xWs = Application.ActiveSheet
On Error Resume Next
Set xCombox = xWs.OLEObjects("TempCombo")
With xCombox
.ListFillRange = ""
.LinkedCell = ""
.Visible = False
End With
If Target.Validation.Type = 3 Then
Target.Validation.InCellDropdown = False
Cancel = True
xStr = Target.Validation.Formula1
xStr = Right(xStr, Len(xStr) - 1)
If xStr = "" Then Exit Sub
Set xRg = Range(xStr)
If xRg Is Nothing Then
xArr1 = Split(xStr, ",")
Else
ReDim xArr1(0 To xRg.Count - 1)
For xI = 0 To xRg.Count - 1
xArr1(xI) = xRg.Item(xI + 1).Value
Next
End If
xI = 0
xCount = UBound(xArr1) + 1
For xJ = 0 To UBound(xArr1)
If Replace(xArr1(xJ), " ", "") = "" Then xCount = xCount - 1
Next
ReDim xArr(0 To xCount - 1)
xIndex = 0
For xJ = 0 To UBound(xArr1)
If Replace(xArr1(xJ), " ", "") <> "" Then
xArr(xIndex) = xArr1(xJ)
xIndex = xIndex + 1
End If
Next
xStr = ""
With xCombox
.Visible = True
.Left = Target.Left
.Top = Target.Top
.Width = Target.Width + 5
.Height = Target.Height + 5
.ListFillRange = xStr
If .ListFillRange = "" Then
'xArr = Split(xStr, ",")
Me.TempCombo.List = xArr
End If
.LinkedCell = Target.Address
End With
xCombox.Activate
Me.TempCombo.DropDown
End If
End Sub
Private Sub TempCombo_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, ByVal Shift As Integer)
Select Case KeyCode
Case 9
Application.ActiveCell.Offset(0, 1).Activate
Case 13
Application.ActiveCell.Offset(1, 0).Activate
End Select
End Sub
This comment was minimized by the moderator on the site
Hi Crystal,
I am working with the combo box (The VBA code from 2021/11/05). It is working great and so useful! thanks a lot.
I found the source of my problem. There was a line of freeze panes which override the combo box.
The only problem now is that the Undo is not working. Any idea?
Thanks in advanced,
Yoni
This comment was minimized by the moderator on the site
Hi,
The code does not support Undo. Sorry for the inconvenience.
This comment was minimized by the moderator on the site
Thanks. Maybe do you know why Worksheet_Change event is not firing once I choose value from the combo box?
This comment was minimized by the moderator on the site
Hi, could you please doublecheck this code, when I use it instead of the dropdown list appearing, the source for the dropdown appears instead. This is the exact function I want, could you please fix it.
This comment was minimized by the moderator on the site
If you use a named range or something similar, like I have with a table column, it will display the named range name instead of the values in that named range. To get what you want, you need to change the xStr to display the worksheet range of that named range, since the .ListFillRange does not take in named ranges directly. This should accomplish it : dim RangeAddress as String: RangeAddress = Range(YourNamedRange).addressand then make the xStr something like this: xStr = "YourWorksheetNameWithTheNamedRangeInIt!" & RangeAddress (important: add the '!' for the sheet reference)
This will make your xStr look something like: NamedRangeSheet!$A$1:$A$5
xStr = Right(xStr, Len(xStr) - 1)

If .ListFillRange = "" Then
xArr = Split(xStr, ",")
Me.TempCombo.List = xArr
End If

with these adjustments your combobox should display the list values instead of the source
This comment was minimized by the moderator on the site
Hi Syu,Sorry I don't quite understand your description. Can you try to be more specific of it?After applying the VBA code mentioned in the above method, when the cell with the data validation drop-down list is checked, the drop-down list turn into a combo box, and then all the items in the list are listed. 
This comment was minimized by the moderator on the site
do you have an example file please?
This comment was minimized by the moderator on the site
Hello. The code is very cool. Please make sure that the formula "INDIRECT" is carried out and displayed. It is very necessary
This comment was minimized by the moderator on the site
The code is not working for a validation list which is created by vba code and the source is a named range
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