Loncat ke daftar isi utama

Bagaimana cara nomor otomatis menggabungkan sel di Excel?

Bagaimana kita bisa mengisi nomor seri ke dalam daftar sel gabungan ukuran berbeda di Excel? Pertama dalam pikiran kita adalah menyeret pegangan IsiOtomatis untuk mengisi sel yang digabungkan, tetapi, dalam kasus ini, kita akan mendapatkan pesan peringatan berikut, dan tidak dapat mengisi sel yang digabungkan.

doc-fill-merged-cell-1

Karena pegangan isian tidak mendukung sel yang digabungkan, di sini, saya dapat berbicara tentang beberapa trik lain untuk menyelesaikan masalah ini.

Nomor otomatis / isi sel gabungan dengan kode VBA


panah gelembung kanan biru Nomor otomatis / isi sel gabungan dengan kode VBA

Kode VBA berikut dapat membantu Anda memberi nomor pada sel gabungan yang dipilih dengan cepat. Harap lakukan sebagai berikut:

1. Tahan ALT + F11 kunci, dan itu membuka Jendela Microsoft Visual Basic for Applications.

2. Klik Menyisipkan > Modul, dan tempel kode berikut di Jendela Modul.

Kode VBA: Sel gabungan nomor otomatis

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. Lalu tekan F5 kunci untuk menjalankan kode ini, dan kotak prompt akan muncul untuk membiarkan Anda memilih sel gabungan yang ingin Anda isi, lihat tangkapan layar:

doc-fill-merged-cell-1

4. Setelah memilih sel yang digabungkan, dan klik OK, sekarang, sel gabungan yang Anda pilih telah diisi dengan nomor urut, lihat tangkapan layar:

doc-fill-merged-cell-1


Artikel terkait:

Bagaimana cara nomor otomatis atau nomor ulang setelah filter di Excel?

Bagaimana cara cepat menggabungkan baris yang berdekatan dengan data yang sama di Excel?

Bagaimana cara memisahkan sel dan mengisi dengan nilai duplikat di Excel?

Alat Produktivitas Kantor Terbaik

馃 Kutools AI Ajudan: Merevolusi analisis data berdasarkan: Eksekusi Cerdas   |  Hasilkan Kode  |  Buat Rumus Khusus  |  Analisis Data dan Hasilkan Grafik  |  Aktifkan Fungsi Kutools...
Fitur Populer: Temukan, Sorot, atau Identifikasi Duplikat   |  Hapus Baris Kosong   |  Gabungkan Kolom atau Sel tanpa Kehilangan Data   |   Putaran tanpa Formula ...
Pencarian Super: VLookup Beberapa Kriteria    VLookup Nilai Berganda  |   VLookup di Beberapa Lembar   |   Pencarian Fuzzy ....
Daftar Drop-down Lanjutan: Buat Daftar Drop Down dengan Cepat   |  Daftar Drop Down yang Bergantung   |  Multi-pilih Drop Down List ....
Manajer Kolom: Tambahkan Jumlah Kolom Tertentu  |  Pindahkan Kolom  |  Alihkan Status Visibilitas Kolom Tersembunyi  |  Bandingkan Rentang & Kolom ...
Fitur Unggulan: Fokus Kisi   |  Tampilan Desain   |   Bar Formula Besar    Manajer Buku Kerja & Lembar   |  Perpustakaan Sumberdaya (Teks otomatis)   |  Pemetik tanggal   |  Gabungkan Lembar Kerja   |  Enkripsi/Dekripsi Sel    Kirim Email berdasarkan Daftar   |  Filter Super   |   Filter Khusus (filter tebal/miring/coret...) ...
15 Perangkat Teratas12 Teks Tools (Tambahkan Teks, Hapus Karakter, ...)   |   50 + Grafik jenis (Gantt Chart, ...)   |   40+ Praktis Rumus (Hitung usia berdasarkan ulang tahun, ...)   |   19 Insersi Tools (Masukkan Kode QR, Sisipkan Gambar dari Jalur, ...)   |   12 Konversi Tools (Angka ke Kata, Konversi Mata Uang, ...)   |   7 Gabungkan & Pisahkan Tools (Lanjutan Gabungkan Baris, Pisahkan Sel, ...)   |   ... dan banyak lagi

Tingkatkan Keterampilan Excel Anda dengan Kutools for Excel, dan Rasakan Efisiensi yang Belum Pernah Ada Sebelumnya. Kutools for Excel Menawarkan Lebih dari 300 Fitur Lanjutan untuk Meningkatkan Produktivitas dan Menghemat Waktu.  Klik Di Sini untuk Mendapatkan Fitur yang Paling Anda Butuhkan...

Deskripsi Produk


Tab Office Membawa antarmuka Tab ke Office, dan Membuat Pekerjaan Anda Jauh Lebih Mudah

  • Aktifkan pengeditan dan pembacaan tab di Word, Excel, PowerPoint, Publisher, Access, Visio, dan Project.
  • Buka dan buat banyak dokumen di tab baru di jendela yang sama, bukan di jendela baru.
  • Meningkatkan produktivitas Anda sebesar 50%, dan mengurangi ratusan klik mouse untuk Anda setiap hari!

 

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