Loncat ke daftar isi utama

Bagaimana cara mengganti nama banyak file dari sebuah folder di Excel?

Mungkin sebagian besar dari kita mengalami masalah ini sehingga kita perlu mengganti nama banyak file dalam satu folder, untuk mengganti nama nama file satu per satu akan membuat kita gila jika ada ratusan atau ribuan file di folder itu. Apakah ada fungsi yang baik bagi kita untuk menangani tugas ini?

Buat daftar semua nama file dari folder tertentu di lembar kerja dengan kutools untuk Excel

Ubah nama beberapa file folder di Excel dengan kode VBA


Jika ada beberapa file yang ingin Anda ganti namanya, pertama, Anda bisa mencantumkan nama file lama di kolom lembar kerja, lalu masukkan nama file baru yang ingin Anda ganti. Untuk mencantumkan semua file dengan cepat di lembar kerja, Anda dapat menggunakan Kutools untuk Excel'S Daftar Nama File utilitas

Setelah menginstal Kutools untuk Excel, lakukan hal berikut :( Unduh Gratis Kutools untuk Excel Sekarang )

1. Klik Kutools Ditambah > Ekspor Impor > Daftar Nama File, lihat tangkapan layar:

2. di Daftar Nama File kotak dialog, klik doc-rename-banyak-file-1 tombol untuk memilih folder file yang Anda ingin daftar file, dan kemudian klik Semua data dari Jenis file, lihat tangkapan layar:

doc-rename-banyak-file-1

3. Lalu klik OK tombol, semua nama file telah dicantumkan di kolom lembar kerja baru, serta beberapa atribut file, dan sekarang, Anda dapat menghapus kolom yang tidak diinginkan lainnya dan hanya membiarkan File Name kolom, lihat tangkapan layar:

doc-rename-banyak-file-1

Klik untuk mengetahui lebih banyak tentang fitur Daftar Nama File ini ...

Unduh Gratis Kutools untuk Excel Sekarang


Setelah mencantumkan semua nama file asli dalam satu kolom A, dan Anda harus mengetikkan nama file baru di kolom B seperti gambar berikut yang ditampilkan:

doc-rename-banyak-file-1

Dan di sini saya akan berbicara tentang kode VBA yang dapat membantu Anda mengganti nama file lama dengan nama file baru sekaligus. Silakan lakukan dengan langkah-langkah berikut:

1. Tahan ALT + F11 kunci, dan itu membuka Jendela Microsoft Visual Basic untuk Aplikasi.

2. Klik Menyisipkan > Modul, dan tempelkan makro berikut di file Jendela modul.

Kode VBA: Ubah nama banyak file dalam satu folder

Sub RenameFiles()
'Updateby20141124
Dim xDir As String
Dim xFile As String
Dim xRow As Long
With Application.FileDialog(msoFileDialogFolderPicker)
    .AllowMultiSelect = False
If .Show = -1 Then
    xDir = .SelectedItems(1)
    xFile = Dir(xDir & Application.PathSeparator & "*")
    Do Until xFile = ""
        xRow = 0
        On Error Resume Next
        xRow = Application.Match(xFile, Range("A:A"), 0)
        If xRow > 0 Then
            Name xDir & Application.PathSeparator & xFile As _
            xDir & Application.PathSeparator & Cells(xRow, "B").Value
        End If
        xFile = Dir
    Loop
End If
End With
End Sub

3. Setelah menempelkan kode, silakan tekan F5 kunci untuk menjalankan kode ini, dan di Browse jendela, pilih folder tempat Anda ingin mengubah nama file, lihat tangkapan layar:

doc-rename-banyak-file-1

4. Dan kemudian klik OK, semua nama file lama segera diganti dengan nama file baru. Lihat tangkapan layar:

doc-rename-banyak-file-1 2 doc-rename-banyak-file-1

Catatan:

1. Ketika Anda membuat daftar nama file lama dan baru, ekstensi file harus disertakan.

2. Dalam kode di atas, referensi A: A menunjukkan daftar nama file lama yang ingin Anda ganti namanya, dan referensi B berisi nama file baru yang ingin Anda gunakan, Anda dapat mengubahnya sesuai kebutuhan


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!

Artikel terkait:

Bagaimana cara membuat lembar kerja urutan dari berbagai sel di Excel?

Bagaimana cara mengganti nama beberapa lembar kerja di Excel?

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 (38)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Great! it work for me
This comment was minimized by the moderator on the site
The above stated code does not detect native language file names in Hindi or Marathi - example "HIN-MALE-CH - 7 - कार"
Here the code does not detect "कार"
Any way to handle this issue?
This comment was minimized by the moderator on the site
Sziasztok!
Ha kép nevébe "/" jelet akarok rakni, akkor min kell változtatnom?
Ha benne van a "/" jel akkor nekem nem működik.

Köszönöm
Andor
This comment was minimized by the moderator on the site
Hello, Benedeczki,

Under normal circumstances, the file name cannot contain the /\:*?<>” symbol, so if your picture name contains the / symbol, the code cannot run normally.
You'd better to remove the / symbol from the file name.
Thank you!
This comment was minimized by the moderator on the site
wow, useful and very helpful. BIG THANKS :)
This comment was minimized by the moderator on the site
Sub RenameMultipleFiles()
With Application.FileDialog(msoFileDialogFolderPicker)
.AllowMultiSelect = False
If .Show = -1 Then
selectDirectory = .SelectedItems(1)
dFileList = Dir(selectDirectory & Application.PathSeparator & "*")

Do Until dFileList = ""
curRow = 0
On Error Resume Next
curRow = Application.Match(dFileList, Range("A:A"), 0)
If curRow > 0 Then
Name selectDirectory & Application.PathSeparator & dFileList As _
selectDirectory & Application.PathSeparator & Cells(curRow, "B").Value
End If

dFileList = Dir
Loop
End If
End With
End Sub

this formula does not rename1st document
This comment was minimized by the moderator on the site
Love this so much! Is there a way to use Kutools to edit metadata tags for music similar to this with filenames? Would love being able to mass edit song tags through Excel rather than on iTunes or other third party song tag editors. Thank you!
This comment was minimized by the moderator on the site
okay Thank you
This comment was minimized by the moderator on the site
Hello. I did this for a couple of files and it worked successfully. The next few files i tried, did not work. There were a few formulas added to the new names, could that be the issue?
This comment was minimized by the moderator on the site
Very helpful. Thank you!
This comment was minimized by the moderator on the site
great, worked great for me
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