![]() ![]() Then click OK button, and in the popped out window, please select the folder which contains the files that you want to move from, see screenshot:ĥ. And then press F5 key to run this code, and a prompt box will pop out to remind you selecting the cells which contain the file names, see screenshot:Ĥ. If TypeName(xVal) = "String" And xVal "" ThenįileCopy xSPathStr & xVal, xDPathStr & xValģ. XDFileDlg.Title = " Please select the destination folder:" Set xDFileDlg = Application.FileDialog(msoFileDialogFolderPicker) XSFileDlg.Title = " Please select the original folder:" Set xSFileDlg = Application.FileDialog(msoFileDialogFolderPicker) Set xRg = Application.InputBox("Please select the file names:", "KuTools For Excel",, ,, ,, 8) VBA code: Move files from one folder to another based on a list in Excel Sub movefiles()ĭim xSFileDlg As FileDialog, xDFileDlg As FileDialogĭim xSPathStr As Variant, xDPathStr As Variant Click Insert > Module, and paste the following VBA code in the Module Window. ![]() Hold down the Alt + F11 keys in Excel, and it opens the Microsoft Visual Basic for Applications window.Ģ. To move the files from one folder to another based on a list of files names, the following VBA code may do you a favor, please do as this:ġ. How could you finish this task as quickly as you can in Excel?Ĭopy or move files from one folder to another based on a list in Excel with VBA code But, now, you need to move or copy these files which names are listed into the worksheet from their original folder to another one as following screenshot shown. ![]() If you have a list of file names in a column in a worksheet, and the files locate in a folder in your computor. How to copy or move files from one folder to another based on a list in Excel? ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |