Loncat ke daftar isi utama

Bagaimana cara menyembunyikan formula tetapi menampilkan hasilnya tanpa melindungi lembar kerja di Excel?

Dalam beberapa kasus, Anda mungkin perlu menyembunyikan rumus di lembar kerja Anda untuk pribadi. Artikel ini berbicara tentang menyembunyikan rumus tetapi menampilkan hasil tanpa melindungi lembar kerja di Excel.

Sembunyikan rumus tetapi tampilkan hasil tanpa melindungi lembar kerja dengan kode VBA


Sembunyikan rumus tetapi tampilkan hasil tanpa melindungi lembar kerja dengan kode VBA

Untuk menyembunyikan rumus tetapi menampilkan hasil tanpa melindungi lembar kerja, lakukan hal berikut.

1. Di lembar kerja Anda perlu menyembunyikan rumus tetapi menampilkan hasilnya, silakan klik kanan tab lembar, dan pilih Lihat kode dari menu klik kanan.

2. Dalam Microsoft Visual Basic untuk Aplikasi jendela, silakan salin dan tempel kode VBA ke jendela Kode.

Kode VBA: menyembunyikan formula tetapi menampilkan hasil tanpa melindungi lembar kerja

Dim xDic As New Dictionary
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    Dim xCell As Range
    Dim xRg As Range
    Set xRg = Range("C1:C10")
    If xDic.Count <> xRg.Count Then
        For Each xCell In xRg
            xDic.Add xCell.Address, xCell.FormulaR1C1
        Next
    End If
    If (Target.Count = 1) And (Not Application.Intersect(xRg, Target) Is Nothing) And (Target.HasFormula) Then
        With Target
            .Value = .Value
        End With
    Else
        For Each xCell In xRg
            xCell.Formula = xDic.Item(xCell.Address)
        Next
    End If
End Sub

Note: Dalam kode, C1: C10 adalah rentang sel yang ingin Anda sembunyikan di dalamnya rumus. Silakan ubah sesuai kebutuhan Anda.

3. Lalu klik Tools > Referensi…. Periksalah Waktu Proses Skrip Microsoft kotak dan klik OK tombol di Referensi - VBAProject jendela. Lihat tangkapan layar:

4. tekan lain + Q kunci untuk menutup Microsoft Visual Basic untuk Aplikasi jendela.

Mulai sekarang, saat Anda mengklik sel dalam rentang yang ditentukan, rumus akan segera disembunyikan di Formula Bar.


Artikel terkait:

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 (20)
Rated 5 out of 5 · 1 ratings
This comment was minimized by the moderator on the site
saya da coba sesuai coding nya, bisa berjalan, tetapi di layar ketika saya klik ke tempat yang dimaksud ada keluar tanda loading, (tanda bulat berkedip). File saya mmg 18 MB, bagaimana caranya agar tidak keluar tanda kedip tersebut ?
This comment was minimized by the moderator on the site
Hi akkia,
The problem you mentioned is not reproduced in my case. May I ask which Excel version you are using?
This comment was minimized by the moderator on the site
dia tetap loading ya ko ?
This comment was minimized by the moderator on the site
Thank you for this code, I really needed something like this
Rated 5 out of 5
This comment was minimized by the moderator on the site
formula worked but the problem is when we close the sheet and reopen it than VBA not worked...
This comment was minimized by the moderator on the site
Hi, To continue using this VBA in future, after adding the code, please save the workbook as an Excel Macro-Enabled Workbook.Click File > Save As. In the Save As dialog box, select Excel Macro-Enabled Workbook from the Save as type drop down list, then click the Save button.And then use this excel macro-enabled workbook in the future.
This comment was minimized by the moderator on the site
Hi Im gracy, i am trying to hide the formula in a particular column without password protecting the sheet. i copy pasted the entire code and changed the cells but still unable to hide the formula. Can you please assist.

This comment was minimized by the moderator on the site
Thank you. Formula Worked.
This comment was minimized by the moderator on the site
after this vba code apply new sum formula result not showing in cell, please help....
This comment was minimized by the moderator on the site
If we press and hold the mouse left click to a cell, the formula shows until you release the left click. Otherwise this should work fine.
This comment was minimized by the moderator on the site
I tried using the VBA code but after applying this code my excel is getting slow and hanged.please help me in resolving this issue.
This comment was minimized by the moderator on the site
There is easy way as well.
Select the cell or cells you want to hide the formula or data.
Go to Home --> Format --> Format Cells --> Number --> Custom
Under Type, Remove General and Enter """"
The cell value or formula do not appear on the screen
However it will appear in the Formula bar if you select the cell.
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