Loncat ke daftar isi utama

Bagaimana cara mengulang baris di atas setiap cetakan kecuali halaman terakhir di Excel?

Dalam banyak kasus, Anda mungkin perlu mengulang baris header di atas setiap halaman yang dicetak di Excel. Tetapi bagaimana cara mengulang baris di atas setiap cetakan kecuali halaman terakhir? Artikel ini akan menunjukkan kepada Anda metode untuk mencapainya.

Ulangi baris di atas setiap hasil cetak kecuali halaman terakhir dengan kode VBA


Ulangi baris di atas setiap hasil cetak kecuali halaman terakhir dengan kode VBA

Anda dapat menjalankan kode VBA di bawah ini untuk mencetak semua halaman dengan baris berulang di atas kecuali halaman terakhir. Silakan lakukan sebagai berikut.

1. Buka lembar kerja yang Anda butuhkan untuk mengulang baris di atas kecuali halaman terakhir, lalu tekan lain + F11 tombol secara bersamaan untuk membuka Microsoft Visual Basic untuk Aplikasi jendela.

2. Dalam Microsoft Visual Basic untuk Aplikasi window, klik Menyisipkan > Modul. Kemudian salin dan tempel kode VBA di bawah ini ke jendela Modul.

VBA: Ulangi baris di atas setiap hasil cetak kecuali halaman terakhir di Excel

Sub RepeatRowsExceptLastPage()
Dim xPages As Long, I As Integer, xRg As Range
On Error Resume Next
xPages = ActiveSheet.PageSetup.Pages.Count
Set xRg = Application.InputBox("Please select a row you need to repeat:", "Kutools for Excel", , , , , , Type:=8)
If xRg Is Nothing Then Exit Sub
On Error Resume Next
    If xPages > 0 Then
        With ActiveSheet.PageSetup
            .PrintTitleRows = xRg.AddressLocal
            ActiveSheet.PrintOut from:=1, To:=xPages - 1
            .PrintTitleRows = ""
             ActiveSheet.PrintOut from:=xPages, To:=xPages
        End With
    End If
End Sub

3. tekan F5 kunci untuk menjalankan kode, lalu a Kutool untuk Excel kotak dialog muncul, pilih rentang baris yang perlu Anda ulangi di atas setiap cetakan kecuali halaman terakhir, lalu klik OK tombol. Lihat tangkapan layar:

Kemudian semua halaman di lembar kerja ini dicetak dengan baris tertentu yang berulang di atas kecuali halaman terakhir.


Terkait artikel:

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 (4)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
In the old Lotus 1-2-3 application, this was easily performed by inserting double colons (::) in the top left most cell (A1) of the sheet where you did not want a header or row repeat. Why can't Microsoft do something just as simple? This should be a built-in process that could be enabled with a single click of the mouse. Why all this complication????
This comment was minimized by the moderator on the site
Hello,


How can i modify the code to export the file to pdf using the same principles instead of printing the document?


Thank you
This comment was minimized by the moderator on the site
Yeah... You would have to export to two .pdfs with different names, then combine those two pdfs (in Adobe?)... I'm in the same boat. Is there a way to automate this last step (via Excel?)? The last page of my exported pdf doesn't require a header.
This comment was minimized by the moderator on the site
Yeah... You would have to export to two .pdfs with different names, then combine those two pdfs (in Adobe?)... I'm in the same boat. Is there a way to automate this last step (via Excel?)? The last page of my exported pdf doesn't require a header.
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
Rate this post:
0   Characters
Suggested Locations