![]() ![]() However, on the other hand, if you are not familiar with Excel VBA, you will meet with errors when modifying the codes. You will find that all the file names in the folder have already appeared in the column A.Ĭompared with the other two methods in the article 2 Methods to Copy the List of All File Names in a Folder into Your Excel Worksheet, you will see that using VBA macro is very convenient. You can click the button “Run Sub” in the toolbar or press the button “F5” on the keyboard to run this macro. If you need to input the file names into other range, you can also modify the codes. And we will input the file names into the column A in a worksheet. In this macro, you need to change the target folder according to your actual need. ![]() ![]() If strFileName "." And strFileName "." Then StrFileName = Dir(strTargetFolder, vbDirectory) StrTargetFolder = "C:\Users\Sample\Desktop\Sales Volume" & "\" In this step, copy the following codes into the new module:ĭim strTargetFolder As String, strFileName As String, nCountItem As Integer.Therefore, you have inserted a new module in the editor. Next choose the option “Module” in the drop-down list.After that, click the tab “Insert” in the toolbar.And then press the shortcut keys “Alt +F11” on the keyboard to open the Visual Basic editor.Open the workbook that you need to input the file names.Copy the List of All File Names in a Folder Follow the steps below and see how to use it. You can also use the VBA macro to finish this task. In our previous article 2 Methods to Copy the List of All File Names in a Folder into Your Excel Worksheet, we have introduced two methods to list all the file names in a folder into a worksheet. In this article, we will introduce a method to input all the file names into a worksheet by using VBA macro. Collecting all the file names in a worksheet is very important to your work. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |