Loncat ke daftar isi utama

Bagaimana cara mengikuti hyperlink ke lembar tersembunyi di Excel?

Misalnya, saya memiliki buku kerja yang berisi beberapa lembar kerja, lembar master pertama memiliki hyperlink ke lembar lain, dan sekarang, saya menyembunyikan semua lembar kecuali yang pertama. Dalam kasus ini, hyperlink yang menautkan ke lembar tersembunyi tidak tersedia. Tapi, bagaimana Anda bisa membuat hyperlink ini berhasil? Ketika Anda mengklik satu hyperlink, lembar tersembunyi yang ditautkan akan dibuka sekaligus seperti gambar berikut yang ditampilkan:

doc hyperlink ke lembar tersembunyi 1

Ikuti hyperlink untuk membuka lembar tersembunyi dengan kode VBA

Ikuti hyperlink untuk membuka lembar tersembunyi dan kemudian sembunyikan lagi dengan kode VBA


Ikuti hyperlink untuk membuka lembar tersembunyi dengan kode VBA

Kode VBA berikut dapat membantu Anda membuka lembar kerja tersembunyi saat mengklik hyperlink relatifnya, lakukan seperti ini:

1. Klik kanan tab lembar yang ingin Anda ikuti hyperlink ke lembar tersembunyi, lalu pilih Lihat kode dari menu konteks, di-pop-out Microsoft Visual Basic untuk Aplikasi jendela, silakan salin dan tempel kode berikut ke dalam Modul kosong:

Kode VBA: Ikuti hyperlink untuk membuka lembar tersembunyi:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'Updateby Extendoffice
    Application.ScreenUpdating = False
    On Error Resume Next
    If Target.Column = 1 Then
        Sheets(Target.Value).Visible = xlSheetVisible
        Sheets(Target.Value).Select
    End If
    Application.ScreenUpdating = True
End Sub

doc hyperlink ke lembar tersembunyi 2

Note: Pada kode di atas, angka 1 dalam Jika Target.Column = 1 Maka script menunjukkan nomor kolom yang berisi hyperlink, harap ubah sesuai kebutuhan Anda.

2. Kemudian simpan dan tutup jendela kode ini, sekarang, ketika Anda mengklik hyperlink yang menautkan ke lembar tersembunyi tertentu, lembar tersembunyi akan dibuka sekaligus.


Ikuti hyperlink untuk membuka lembar tersembunyi dan kemudian sembunyikan lagi dengan kode VBA

Terkadang, Anda perlu mengikuti hyperlink untuk membuka lembar tersembunyi, dan saat Anda kembali ke lembar master, Anda ingin lembar yang dibuka disembunyikan lagi. Kode VBA di bawah ini dapat membantu Anda:

1. Klik kanan tab lembar yang ingin Anda ikuti hyperlink ke lembar tersembunyi, lalu pilih Lihat kode dari menu konteks, di-pop-out Microsoft Visual Basic untuk Aplikasi jendela, silakan salin dan tempel kode berikut ke dalam Modul kosong:

Kode VBA: Ikuti hyperlink untuk membuka lembar tersembunyi saat kembali menyembunyikannya lagi:

Private Sub Worksheet_FollowHyperlink(ByVal Target As Hyperlink)
   'Updateby Extendoffice
    Application.ScreenUpdating = False
    Dim strLinkSheet As String
    If InStr(Target.Parent, "!") > 0 Then
        strLinkSheet = Left(Target.Parent, InStr(1, Target.Parent, "!") - 1)
    Else
        strLinkSheet = Target.Parent
    End If
    Sheets(strLinkSheet).Visible = True
    Sheets(strLinkSheet).Select
    Application.ScreenUpdating = True
End Sub

Private Sub Worksheet_Activate()
    On Error Resume Next
    Sheets(ActiveCell.Value2).Visible = False
End Sub

doc hyperlink ke lembar tersembunyi 3

2. Kemudian simpan iklan tutup jendela kode, ketika Anda mengklik hyperlink, lembar tersembunyi yang ditautkan akan segera dibuka, tetapi, jika Anda kembali ke master sheet yang berisi hyperlink, lembar yang dibuka akan disembunyikan lagi secara otomatis.

Note: Kode ini hanya diterapkan ke nama lembar yang cocok dengan teks hyperlink Anda.


Demo: Ikuti hyperlink untuk membuka lembar tersembunyi dengan kode VBA

Kutools untuk Excel: dengan lebih dari 300 add-in Excel yang praktis, gratis untuk dicoba tanpa batasan dalam 30 hari. Unduh dan uji coba gratis Sekarang!

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 (9)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Not sure if I will get a response to this one, but when I click the any of my hyperlinks I get a "reference isn't valid" error.
Everything still works, I just need to click ok to continue.
Does anyone have an idea what causes this error for this code?
Thank you,
This comment was minimized by the moderator on the site
I have created many wordbook and I want to index those in one page.

N.B: My point is I want to hide all the sheets, the sheets will linked with setting picture to main page. By clicking the picture linked sheet will be shown and when I come back to the main sheet the un-hide sheet will be hidden again
This comment was minimized by the moderator on the site
I would like to use this code but only want it to apply to column A. I have other web address links in other cells which cause a problem when running this code.
This comment was minimized by the moderator on the site
My hyperlink "text" is number only, and it doesn't work...
This comment was minimized by the moderator on the site
I'm using the code on two different sheets. It works for one of about 40 hyperlinks on one sheet and it opens two of about 10 hyperlinks one she second, the sheets on the second which do open do go back into hiding when I return to the sheet. The error I get when it will not open a sheet is Run-time error"9": script out of range and the code it points me to - Sheets(strLinkSheet).Visible = True Any ideas as to what change is needed make the code work on all of the sheets? Thank you in advance.
This comment was minimized by the moderator on the site
I have used this code on two different sheets in my workbook, and in both cases it works great, except for the first hyperlink on each page. I get "Subscript out of range error" and the debugger points to the "Sheets(strLinkSheet).Visible = True" right after the "end if". Anyone else see this error? It is only on the first link on the page. (my hyperlinks are in column A, and start in row 2)
This comment was minimized by the moderator on the site
[quote]I have used this code on two different sheets in my workbook, and in both cases it works great, except for the first hyperlink on each page. I get "Subscript out of range error" and the debugger points to the "Sheets(strLinkSheet).Visible = True" right after the "end if". Anyone else see this error? It is only on the first link on the page. (my hyperlinks are in column A, and start in row 2)By HelzBelz[/quote] Sheet names can't have space like "Sheet 1". I fixed my sheet names to "Sheet1" and the error stopped.
This comment was minimized by the moderator on the site
I have a sheet that is hidden that contains a hyperlink. I would like to be able go to the hidden sheet and have it close when I go back to the original sheet. I used the code but it does not work.
This comment was minimized by the moderator on the site
I am trying to hide a sheet that has a hyperlink. I would like to be able to click on the sheet go to the hyperlink sheet and then click back to the sheet and close the hidden sheet. I have tried your instructions but it does not work. Not sure what I am doing wrong.
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
Rate this post:
0   Characters
Suggested Locations