メインコンテンツへスキップ

Excelでフォルダの複数のファイルの名前を変更するにはどうすればよいですか?

私たちのほとんどは、フォルダ内の複数のファイルの名前を変更する必要があるというこの問題に苦しんでいる可能性があります。ファイル名をXNUMXつずつ名前変更すると、そのフォルダに数百または数千のファイルがあると気が狂います。 このタスクに対処するための良い機能はありますか?

kutools for Excelを使用して、ワークシートの特定のフォルダーからすべてのファイル名を一覧表示します

VBAコードを使用してExcelのフォルダーの複数のファイルの名前を変更します


名前を変更するファイルが複数ある場合は、最初にワークシートの列に古いファイル名をリストしてから、置き換える新しいファイル名を入力できます。 ワークシート内のすべてのファイルをすばやく一覧表示するには、 Kutools for Excelさん ファイル名リスト ユーティリティ。

インストールした後 Kutools for Excel、次のようにしてください:( 今すぐExcel用Kutoolsを無料でダウンロード )

1に設定します。 OK をクリックします。 クツールズプラス > インポート・エクスポート > ファイル名リスト、スクリーンショットを参照してください:

2。 の中に ファイル名リスト ダイアログボックスで、をクリックします。 doc-rename-multiple-files-1 ボタンをクリックして、ファイルを一覧表示するファイルフォルダーを選択し、[ すべてのファイル ファイルタイプ、スクリーンショットを参照してください:

doc-rename-multiple-files-1

3。 次に、をクリックします OK ボタンをクリックすると、すべてのファイル名が新しいワークシートの列と一部のファイル属性に一覧表示されます。これで、他の不要な列を削除して、 ファイル名 列、スクリーンショットを参照してください:

doc-rename-multiple-files-1

このファイル名リスト機能の詳細については、クリックしてください…

今すぐExcel用Kutoolsを無料でダウンロード


XNUMXつの列Aにすべての元のファイル名をリストした後、次のスクリーンショットのように列Bに新しいファイル名を入力する必要があります。

doc-rename-multiple-files-1

ここでは、古いファイル名を新しいファイル名に一度に置き換えるのに役立つVBAコードについて説明します。 次の手順で実行してください。

1。 を押し続けます Alt + F11 キー、そしてそれは開きます Microsoft Visual Basic forApplicationsウィンドウ.

2に設定します。 OK をクリックします。 インセット > モジュール、次のマクロをに貼り付けます モジュールウィンドウ.

VBAコード:フォルダー内の複数のファイルの名前を変更します

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。 コードを貼り付けたら、を押してください F5 このコードを実行するためのキー、および ブラウズ ウィンドウで、ファイル名を変更するフォルダを選択します。スクリーンショットを参照してください。

doc-rename-multiple-files-1

4。 そして、 OK、すべての古いファイル名はすぐに新しいファイル名に置き換えられました。 スクリーンショットを参照してください:

doc-rename-multiple-files-1 2 doc-rename-multiple-files-1

注意:

1.古いファイル名と新しいファイル名をリストするときは、ファイル拡張子を含める必要があります。

2.上記のコードでは、参照 A:A 名前を変更する古いファイル名リストを示し、参照します B 使用したい新しいファイル名が含まれているので、必要に応じて変更できます


Kutools for Excel:300以上の便利なExcelアドインがあり、30日以内に制限なしで無料で試すことができます。 今すぐダウンロードして無料トライアル!

関連記事:

Excelのセルの範囲からシーケンスワークシートを作成するにはどうすればよいですか?

Excelで複数のワークシートの名前を変更するにはどうすればよいですか?

最高のオフィス生産性向上ツール

🤖 Kutools AI アシスタント: 以下に基づいてデータ分析に革命をもたらします。 インテリジェントな実行   |  コードを生成  |  カスタム数式の作成  |  データを分析してグラフを生成する  |  Kutools関数を呼び出す...
人気の機能: 重複を検索、強調表示、または識別する   |  空白行を削除する   |  データを失わずに列またはセルを結合する   |   数式なしのラウンド ...
スーパールックアップ: 複数の基準の VLookup    複数の値の VLookup  |   複数のシートにわたる VLookup   |   ファジールックアップ ....
詳細ドロップダウン リスト: ドロップダウンリストを素早く作成する   |  依存関係のドロップダウン リスト   |  複数選択のドロップダウンリスト ....
列マネージャー: 特定の数の列を追加する  |  列の移動  |  Toggle 非表示列の表示ステータス  |  範囲と列の比較 ...
注目の機能: グリッドフォーカス   |  デザインビュー   |   ビッグフォーミュラバー    ワークブックとシートマネージャー   |  リソースライブラリ (自動テキスト)   |  日付ピッカー   |  ワークシートを組み合わせる   |  セルの暗号化/復号化    リストごとにメールを送信する   |  スーパーフィルター   |   特殊フィルター (太字/斜体/取り消し線をフィルター...) ...
上位 15 のツールセット12 テキスト ツール (テキストを追加, 文字を削除する、...)   |   50+ チャート 種類 (ガントチャート、...)   |   40+ 実用的 (誕生日に基づいて年齢を計算する、...)   |   19 挿入 ツール (QRコードを挿入, パスから画像を挿入、...)   |   12 変換 ツール (数字から言葉へ, 通貨の換算、...)   |   7 マージ&スプリット ツール (高度な結合行, 分割セル、...)   |   ... もっと

Kutools for Excel で Excel スキルを強化し、これまでにない効率を体験してください。 Kutools for Excelは、生産性を向上させ、時間を節約するための300以上の高度な機能を提供します。  最も必要な機能を入手するにはここをクリックしてください...

説明


Officeタブは、タブ付きのインターフェイスをOfficeにもたらし、作​​業をはるかに簡単にします

  • Word、Excel、PowerPointでタブ付きの編集と読み取りを有効にする、パブリッシャー、アクセス、Visioおよびプロジェクト。
  • 新しいウィンドウではなく、同じウィンドウの新しいタブで複数のドキュメントを開いて作成します。
  • 生産性を 50% 向上させ、毎日何百回もマウス クリックを減らすことができます!
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