Loncat ke daftar isi utama

Bagaimana cara selalu mengapung Tombol Perintah pada lembar kerja di Excel?

Dalam beberapa kasus, Anda mungkin memerlukan Tombol Perintah mengambang (Kontrol ActiveX) untuk terus bergerak dengan lembar kerja Anda tidak peduli bagaimana Anda menggulir ke atas atau ke bawah lembar kerja. Artikel ini akan menunjukkan kepada Anda metode untuk mencapainya.

Selalu mengambang Tombol Perintah pada lembar kerja dengan kode VBA


Selalu mengambang Tombol Perintah pada lembar kerja dengan kode VBA

Harap lakukan hal berikut untuk membuat Tombol Perintah selalu mengambang di lembar kerja.

1. Di lembar kerja yang berisi Tombol Perintah Kontrol ActiveX yang Anda inginkan untuk mengambang, klik kanan tab lembar, lalu klik Lihat kode dari menu konteks

2. Dalam bermunculan Microsoft Visual Basic untuk Aplikasi jendela, salin dan tempel kode VBA di bawah ini ke jendela Kode.

Kode VBA: Buat Tombol Perintah selalu mengambang di lembar kerja

Private Sub Worksheet_SelectionChange(ByVal Target As Excel.Range)
        On Error GoTo 0
        With Cells(Windows(1).ScrollRow, Windows(1).ScrollColumn)
            CommandButton1.Top = .Top + 100
            CommandButton1.Left = .Left + 300
        End With
End Sub

Note: dalam kode di atas, CommandButton1 adalah nama tombol yang Anda ingin selalu terlihat. Harap ubah sesuai kebutuhan Anda.

3. Kemudian tekan lain + Q kunci untuk keluar dari Microsoft Visual Basic untuk Aplikasi jendela.

Mulai sekarang, Tombol Perintah akan selalu mengambang di tengah atas lembar kerja dengan perpindahan sel yang diklik aktif seperti gambar di bawah ini.

Note: VBA ini hanya bekerja untuk Tombol Perintah Kontrol ActiveX.


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 (15)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
it works fine in one workbook, now i tried to do the same thing in another workbook and i got a compiling error because of the selectionchange. i'm pretty new in vba - maybe it's because i already got a private sub worksheet_selectionchange? do you know how i can fix this? 
This comment was minimized by the moderator on the site
I think it should specify that the button has to be an ActiveX one to the code work. ^.^'
This comment was minimized by the moderator on the site
Hi,
Thank you for your reminder.
This comment was minimized by the moderator on the site
I think it should specify that the button has to be an ActiveX one to the code work. ^.^'
This comment was minimized by the moderator on the site
Does not work :-(
This comment was minimized by the moderator on the site
Hi,
When you scrolling down the worksheet, please click to change the active cell to the visible area to make it work. Thank you for your comment.
This comment was minimized by the moderator on the site
see it, not working, i'm scrolling down and also command button down, i want to fix on the top of right side of sheet.
This comment was minimized by the moderator on the site
Hi,
When you scrolling down the worksheet, please click to change the active cell to the visible area to make it work. Thank you for your comment.
This comment was minimized by the moderator on the site
not working
This comment was minimized by the moderator on the site
Thanks a lot ... It worked...
This comment was minimized by the moderator on the site
Works fine for me. Thx
This comment was minimized by the moderator on the site
Thanks its good with cellselecting
This comment was minimized by the moderator on the site
Not good QA - check your name on the button. If this is what gets published for the Web community to see, what goes in behind the scenes with the code? :-)
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