Preskoči na glavno vsebino

Kako samodejno številčiti združene celice v Excelu?

Kako lahko v Excel vnesemo serijske številke na seznam združenih celic različnih velikosti? Najprej v mislih povlecimo ročico za samodejno izpolnjevanje, da zapolnimo združene celice, vendar bomo v tem primeru dobili naslednje opozorilno sporočilo in združenih celic ne moremo zapolniti.

doc-fill-medged-cells-1

Ker ročaj za polnjenje ne podpira združenih celic, lahko tukaj govorim o nekaterih drugih trikih za reševanje te težave.

Samodejno številči / napolni združene celice s kodo VBA


puščica modri desni mehurček Samodejno številči / napolni združene celice s kodo VBA

Naslednja koda VBA vam lahko pomaga hitro oštevilčiti izbrane združene celice. Naredite naslednje:

1. Držite tipko ALT + F11 in odpre tipko Okno Microsoft Visual Basic for Applications.

2. Kliknite Vstavi > Moduliin prilepite naslednjo kodo v Okno modula.

Koda VBA: Samodejno število spojenih celic

Sub NumberCellsAndMergedCells()
	'Update 20141028
	Dim Rng As Range
	Dim WorkRng As Range
	On Error Resume Next
	xTitleId = "KutoolsforExcel"
	Set WorkRng = Application.Selection
	Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type: = 8)
	Set WorkRng = WorkRng.Columns(1)
	xIndex = 1
	Set Rng = WorkRng.Range("A1")
	Do While Not Intersect(Rng, WorkRng) Is Nothing
		Rng.Value = xIndex
		xIndex = xIndex + 1
		Set Rng = Rng.MergeArea.Offset(1)
	Loop
End Sub

3. Nato pritisnite F5 tipko za zagon te kode in pojavilo se bo pozivno polje, v katerem boste lahko izbrali združene celice, ki jih želite zapolniti, glejte posnetek zaslona:

doc-fill-medged-cells-1

4. Po izbiri združenih celic in kliknite OK, zdaj so vaše izbrane združene celice napolnjene z zaporednimi številkami, glejte posnetek zaslona:

doc-fill-medged-cells-1


Sorodni članki:

Kako samodejno številčiti ali preštevilčiti po filtru v Excelu?

Kako hitro združiti sosednje vrstice z enakimi podatki v Excelu?

Kako odstraniti celice in jih napolniti s podvojenimi vrednostmi v Excelu?

Najboljša pisarniška orodja za produktivnost

🤖 Kutools AI Aide: Revolucionirajte analizo podatkov na podlagi: Inteligentna izvedba   |  Ustvari kodo  |  Ustvarite formule po meri  |  Analizirajte podatke in ustvarite grafikone  |  Prikličite funkcije Kutools...
Priljubljene funkcije: Poiščite, označite ali identificirajte dvojnike   |  Izbriši prazne vrstice   |  Združite stolpce ali celice brez izgube podatkov   |   Krog brez formule ...
Super iskanje: Več kriterijev VLookup    Multiple Value VLookup  |   VLookup na več listih   |   Nejasno iskanje ....
Napredni spustni seznam: Hitro ustvarite spustni seznam   |  Odvisni spustni seznam   |  Večkrat izberite spustni seznam ....
Upravitelj stolpcev: Dodajte določeno število stolpcev  |  Premakni stolpce  |  Preklop stanja vidnosti skritih stolpcev  |  Primerjaj obsege in stolpce ...
Predstavljene funkcije: Mrežni fokus   |  Pogled oblikovanja   |   Velika vrstica formule    Upravitelj delovnih zvezkov in listov   |  Knjižnica virov (Samodejno besedilo)   |  Izbirnik datuma   |  Združite delovne liste   |  Šifriranje/dešifriranje celic    Pošljite e-pošto po seznamu   |  Super filter   |   Poseben filter (filter krepko/ležeče/prečrtano ...) ...
15 najboljših kompletov orodij12 Besedilo Orodja (dodajanje besedila, Odstrani znake,...)   |   50 + Graf Vrste (Gantt Chart,...)   |   40+ Praktično Formule (Izračunajte starost glede na rojstni dan,...)   |   19 vstavljanje Orodja (Vstavite kodo QR, Vstavi sliko s poti,...)   |   12 Pretvorba Orodja (Številke v besede, Pretvorba valut,...)   |   7 Spoji in razdeli Orodja (Napredne kombinirane vrstice, Razdeljene celice,...)   |   ... in več

Napolnite svoje Excelove spretnosti s Kutools za Excel in izkusite učinkovitost kot še nikoli prej. Kutools za Excel ponuja več kot 300 naprednih funkcij za povečanje produktivnosti in prihranek časa.  Kliknite tukaj, če želite pridobiti funkcijo, ki jo najbolj potrebujete...

Opis


Kartica Office prinaša vmesnik z zavihki v Office in poenostavi vaše delo

  • Omogočite urejanje in branje z zavihki v Wordu, Excelu, PowerPointu, Publisher, Access, Visio in Project.
  • Odprite in ustvarite več dokumentov v novih zavihkih istega okna in ne v novih oknih.
  • Poveča vašo produktivnost za 50%in vsak dan zmanjša na stotine klikov miške za vas!

 

Comments (10)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Thank you!! :)
This comment was minimized by the moderator on the site
Cuando se generan celdas combinadas de diferentes tamaños, y que queremos numerar, podemos seleccionarlas y vaciar el contenido... en seguida con la siguiente fórmula : =IF(Q7="",(COUNTIF($Q$7:Q7,"")),SUBSTITUTE("TRUE","TRUE","")) esta detectará que no hay nada y en la casilla combinada pondrá un consecutivo iniciando con el 1- No importa el tamaño de la celda combinada, solo pondrá el numero al principio de la celda combinada.
This comment was minimized by the moderator on the site
Hi,

How to convert a cell with

Apple, Lemon, Water, Soda, Cap, Bat

into

1. Apple, 2. Lemon, 3. Water, 4. Cap, 5. Bat
This comment was minimized by the moderator on the site
Is there a way to exclude a merged cell that has text in it? This script works perfectly but I'm traversing a document that includes several horizontally merged cells that are made into title bars and I want to skip over/exclude those. Any help would be greatly appreciated!
This comment was minimized by the moderator on the site
This code is working perfectly.


Sub NumberCellsAndMergedCells()
'Update 20141028
Dim Rng As Range
Dim WorkRng As Range
On Error Resume Next
xTitleId = "KutoolsforExcel"
Set WorkRng = Application.Selection
Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type: = 8)
Set WorkRng = WorkRng.Columns(1)
xIndex = 1
Set Rng = WorkRng.Range("A1")
Do While Not Intersect(Rng, WorkRng) Is Nothing
Rng.Value = xIndex
xIndex = xIndex + 1
Set Rng = Rng.MergeArea.Offset(1)
Loop
End Sub


BUT i want it to select range automatically instead of Set WorkRng = Application.Selection.
Please help.
This comment was minimized by the moderator on the site
I purchased the Kutools so it would help me auto increment my invoice numbering but I am not seeing that feature in the add-in on the Excel tool bar. Maybe I'm not looking for the correct name but I am not finding how to insert this into my invoice template. Any out there
This comment was minimized by the moderator on the site
Hi, was wondering if there is anyway to alter the code where the range value will increase by one e.g. I am trying to use this for invoices and the number should go from NR000026489 to NR000026490, but using the code above with the modification given to JYOTHI it would increase from NR000026489 to NR0000264810. Any help would be greatly appreciated as I've spent ages trying different things but am not advanced enough in VB. Thanks very much :)
This comment was minimized by the moderator on the site
Modify: Do While Not Intersect(Rng, WorkRng) Is Nothing a = xIndex Rng.Value = "Tc_" & a xIndex = xIndex + 1 Set Rng = Rng.MergeArea.Offset(1) Loop
This comment was minimized by the moderator on the site
It is very helpful. but I need one solution, suppose I want to fill series into merged cells but the content of merged cell have data like TC_01, Is it possible to fill next merged cells like TC_02, TC_03etc.. If its possible it helps me a lot. Thanks in advance.
This comment was minimized by the moderator on the site
This was really helpful and solved my problem immediately, thank you very much!
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations