Loncat ke daftar isi utama

Bagaimana cara memaksa string teks menjadi huruf besar / huruf kecil / huruf besar di Excel?

Di Excel, saat Anda memasukkan beberapa huruf atau kata ke dalam sel, Anda ingin memaksa string teks menjadi huruf besar meskipun Anda memasukkan huruf kecil atau huruf kapital yang tepat dan sebaliknya. Sebagian besar dari kita mungkin mempertimbangkan fitur Validasi Data di Excel, dengan fungsi ini, kita akan mendapatkan peringatan ketika kita tidak mengetikkan huruf yang benar dari teks. Pada artikel ini, saya akan memperkenalkan beberapa cara menarik untuk memaksa teks menjadi huruf besar, huruf kecil, atau huruf besar sesuai kebutuhan Anda.

Paksa string teks menjadi huruf besar / kecil / huruf besar dengan Validasi Data

Paksa string teks menjadi huruf besar / kecil / huruf besar dengan kode VBA

Ubah teks menjadi UPPERCASE / huruf kecil / Kasus yang Tepat dengan Kutools for Excel ide bagus3


Validasi Data adalah alat yang ampuh di Excel, ini dapat membantu kita melakukan banyak operasi, dengan bantuannya, kita juga dapat memaksa string teks huruf besar, huruf kecil atau huruf yang tepat saat mengetik, lakukan hal berikut:

1. Pergi ke klik Data > Validasi Data > Validasi Data, lihat tangkapan layar:

doc-force-huruf besar-1

2. di Validasi Data dialog, di bawah Settings tab, klik mengizinkan daftar drop-down dan pilih Kustom opsi, lalu di Rumus kotak teks, masukkan rumus ini = PERSIS (ATAS (A1), A1), (A1 singkatan dari kolom yang akan Anda terapkan fitur ini, Anda dapat mengubahnya sesuai kebutuhan Anda), lihat tangkapan layar:

doc-force-huruf besar-1

3. Kemudian Anda dapat membuat lansiran sesuai kebutuhan, silakan klik Peringatan Kesalahan tab, dan pilih berhenti dari Gaya daftar drop-down, di pojok kanan Error message kotak teks, masukkan pesan peringatan Anda sendiri, lihat tangkapan layar:

doc-force-huruf besar-1

4. Dan kemudian klik OK untuk menutup dialog, sekarang ketika Anda memasukkan string teks bukan dalam huruf besar di kolom A, kotak peringatan akan muncul untuk mengingatkan Anda memasukkan huruf besar.

doc-force-huruf besar-1

Catatan:

Jika Anda perlu memaksa string teks menjadi huruf kecil atau huruf besar, harap terapkan rumus berikut ke dalam Validasi Data di langkah 2

Paksa ke huruf kecil: = EXACT (LOWER (A1), A1);

Paksa ke kasus yang tepat: = EXACT (PROPER (A1), A1)


Dengan kode VBA berikut, saat Anda memasukkan kata huruf kecil ke dalam sel, teks huruf kecil akan diubah menjadi huruf besar secara otomatis.

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

2. Kemudian pilih lembar kerja bekas Anda dari kiri Penjelajah Proyek, klik dua kali untuk membuka file Modul, lalu salin dan tempel kode VBA berikut ke dalam modul kosong:

Kode VBA: Paksa string teks menjadi huruf besar

Private Sub Worksheet_Change(ByVal Target As Range)
'Update 20140603
Target.Value = VBA.UCase(Target.Value)
End Sub

doc-force-huruf besar-1

3. Kemudian simpan dan tutup kode ini untuk kembali ke lembar kerja, sekarang saat Anda memasukkan string teks setiap kali itu huruf kecil atau huruf besar, itu akan menjadi huruf besar setelah mengetuk Enter kunci secara otomatis.

Catatan:

1. Kode ini diterapkan ke seluruh lembar kerja.

2. Jika Anda tidak dapat menemukan PPanel Penjelajah proyek di jendela, Anda dapat mengklik View > Penjelajah Proyek untuk membukanya

3. Untuk memaksa kata huruf kecil atau benar, Anda dapat menerapkan kode VBA berikut: (Prosedurnya sama seperti di atas)

Kode VBA: Paksa string teks menjadi Huruf kecil

Private Sub Worksheet_Change(ByVal Target As Range)
'Update 20140603
Target.Value = VBA.LCase(Target.Value)
End Sub

Kode VBA: Paksa string teks ke kapitalisasi yang tepat

Private Sub Worksheet_Change(ByVal Target As Range)
'Update 20140603
Target.Value = Application.WorksheetFunction.Proper(Target.Value)
End Sub

Jika Anda hanya ingin mengubah beberapa teks tertentu menjadi UPPERCASE, huruf kecil, atau Kasus yang Tepat, Anda dapat menerapkan Ubah Kasus kegunaan Kutools untuk Excel untuk menyelesaikannya dengan cepat.

Kutools untuk Excel, dengan lebih dari 300 fungsi praktis, membuat pekerjaan Anda lebih mudah. 

Setelah pemasangan gratis Kutools for Excel, lakukan seperti di bawah ini:

1. Pilih teks yang ingin Anda ubah kapitalisasi dan klik Kutools > Teks > Ubah Kasus. Lihat tangkapan layar:
kasus perubahan dokumen 6

2. Dalam Ubah Kasus dialog, periksa opsi operasi yang Anda butuhkan, dan Anda dapat melihat hasilnya di Preview panel. Lihat tangkapan layar:
kasus perubahan dokumen 2

3. klik Ok or Mendaftar dan teks telah berubah kasus.

 Ubah ke UPPERCASE  Ubah ke Kasus yang Tepat  Ubah ke kasus Kalimat
 kasus perubahan dokumen 3  kasus perubahan dokumen 4 kasus perubahan dokumen 5 

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
Please suggest modifications in the VBA code to force the text strings to change to the desired format (Upper/Lower/Proper case) in selected/specified cells only rather than changing the Case of the text strings in the entire worksheet.
This comment was minimized by the moderator on the site
Hello, DS,
To apply the code to a specified range instead of entire worksheet, please apply the following code:
VBA code: Force text string to uppercase
Private Sub Worksheet_Change(ByVal Target As Range)
    Dim SpecifiedRange As Range
    Set SpecifiedRange = Me.Range("A1:A10")
    If Not Intersect(Target, SpecifiedRange) Is Nothing Then
        Application.EnableEvents = False
        Target.Value = VBA.UCase(Target.Value)
        Application.EnableEvents = True
    End If
End Sub


VBA code: Force text string to lowercase
Private Sub Worksheet_Change(ByVal Target As Range)
    Dim SpecifiedRange As Range
    Set SpecifiedRange = Me.Range("A1:A10")
    If Not Intersect(Target, SpecifiedRange) Is Nothing Then
        Application.EnableEvents = False
        Target.Value = VBA.LCase(Target.Value)
        Application.EnableEvents = True
    End If
End Sub


VBA code: Force text string to propercase
Private Sub Worksheet_Change(ByVal Target As Range)
    Dim SpecifiedRange As Range
    Set SpecifiedRange = Me.Range("A1:A10")
    If Not Intersect(Target, SpecifiedRange) Is Nothing Then
        Application.EnableEvents = False
        Target.Value = Application.Proper(Target.Value)
        Application.EnableEvents = True
    End If
End Sub


Please have a try, thank you!
This comment was minimized by the moderator on the site
Use: On Error Resume Next

Private Sub Worksheet_Change(ByVal Target As Range)
'Update 20140603
On Error Resume Next
Target.Value = Application.WorksheetFunction.Proper(Target.Value)
End Sub
This comment was minimized by the moderator on the site
muchas gracias, sirvio enormemente estos codigos
This comment was minimized by the moderator on the site
This worked for me, however if you went to delete the contents of the cell then a "runtime error '13': type mismatch" came up

Any ideas?
This comment was minimized by the moderator on the site
i have the same problem. if you know how to deal with it please tell me!
This comment was minimized by the moderator on the site
Hello, which method you use will come up the errors?
This comment was minimized by the moderator on the site
Like your VBA solution, but how could I limit it to a single column and format other columns differently, e.g., columns A and C force uppercase, column B force proper case?
This comment was minimized by the moderator on the site
I do not know which VBA can handle your job (some columns in uppercase, some in proper case), but the data validation can solve it, why do not use it?
This comment was minimized by the moderator on the site
thanks for the macro to convert all entries to capital letters, but is there something i need to do to stop the macro from crashing excel every fe minutes? Appreciate the help!
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations