Copy Specific Files or All Files from Source Folder to Destination Folder with VBA

Поділитися
Вставка
  • Опубліковано 4 жов 2024
  • How to copy specific files or all files from source folder to destination folder with VBA.
    At 8.01 the code for the message box should be:
    MsgBox destinationPath & " does not exist" and not sourcePath!
    VBA code and other details available at: www.exceltrain...

КОМЕНТАРІ • 111

  • @juanpaolo21yt
    @juanpaolo21yt Рік тому +1

    whenever I see ur name or channel In the search results, you are my first pick. most of the time, you answered my question. Just like now. MANY THANKS TO YOU DINESH! from Manila PH

  • @thimmithim
    @thimmithim 5 років тому +4

    After googling for hours, yours was the most helpful to accomplish the goal I wanted to reach. Thank you for sharing Dinesh.

  • @drm9514
    @drm9514 5 років тому +1

    Very Useful. Thanks Dinesh

  • @aset012585
    @aset012585 4 роки тому

    Thank you. It’s working perfectly.

  • @chandrasekharsrinivas9887
    @chandrasekharsrinivas9887 6 років тому

    Hi sir good morning
    very nice video and more helpful to us, thank you

  • @mechsparks
    @mechsparks 5 років тому +1

    Thank u for the video...very helpful

    • @Exceltrainingvideos
      @Exceltrainingvideos  5 років тому

      Please share with your friends and on social media. You can view more videos in Hindi and English at www.exceltrainingvideos.com/

  • @ranajsingh
    @ranajsingh 4 роки тому

    Thanks sir, this code helped me a lot.

    • @Exceltrainingvideos
      @Exceltrainingvideos  4 роки тому

      Glad to hear that! Please share the VBA tutorial with your friends.

  • @charlesdawnbeltran9603
    @charlesdawnbeltran9603 5 років тому +2

    Thank you for the very useful video sir. I just want to ask if it's possible to manually select the file/s that you want to copy instead of copying it automatically?

  • @priyanka1991ism
    @priyanka1991ism 5 років тому

    Thank You for the video, I have to copy the excel file to multiple destination paths (paths are mentioned in an excel sheet)

    • @Exceltrainingvideos
      @Exceltrainingvideos  5 років тому

      This link will help: www.exceltrainingvideos.com/automating-new-report-creation-from-updated-raw-data/

    • @mohdqasm6946
      @mohdqasm6946 3 роки тому

      Have you found a way to move these files? I have the same issue. I have to copy the excel file to multiple destination paths

  • @shadop5399
    @shadop5399 4 роки тому +1

    Thank you sir for this valuable information but can we copy excel or doc based on the file name i'll mentioned in cell of a excel, like I want to copy a file name with File name 1 : Dinesh, File name 2 : Kumar, File name 1 : Takyar

  • @InsideMyWall
    @InsideMyWall 2 роки тому

    How to browse a folder or file via Excel VBA, copy the name of the file and paste it in a specified word file and export as pdf??

  • @shanthichinni-uz1cx
    @shanthichinni-uz1cx Рік тому

    Thankyou for the video sir... Can we copy files bases on today date modified

  • @ALEXSHUNCAI
    @ALEXSHUNCAI Рік тому

    what if I want to transfer multiple files according to the "Date Modified" to a specific folder? Are there any examples I can share with? Thanks, by the way, good video on this matter.

  • @viswanathponne
    @viswanathponne 2 роки тому

    Thank you sir

  • @sudheerkonjarla930
    @sudheerkonjarla930 5 років тому

    Thanks for usful Vedio sir. Can we paste the souce file and destinaion path in message box instead of vba code? if yes, please help me how to do that.
    Thanks in advance

  • @Manas1990_Vlogs
    @Manas1990_Vlogs 7 років тому

    Very nice video sir .. can you make a video on the soap request sending using Vba or excel

  • @SHANKAR_328
    @SHANKAR_328 Рік тому

    can you please help me make a drag and drop UI to copy a specific files in excel.

  • @apoorvadhoot8493
    @apoorvadhoot8493 5 років тому

    The title states copying specific files. But you are copying all files in this video. I still don't understand how to copy specific files. My source folder has 100s of files and i only want 5. Can you please clarify.

    • @Exceltrainingvideos
      @Exceltrainingvideos  5 років тому

      The title is: Copy Specific Files or All Files from Source Folder to Destination Folder with VBA
      This link will help: www.exceltrainingvideos.com/copy-specific-files-or-all-files-from-source-folder-to-destination-folder-with-vba/

  • @accnotech3863
    @accnotech3863 7 років тому

    Sir, Thankyou So much, I just needed these codes so badly, but there are two doubts, First , What if I want to copy only a specific file, and secondly my destination folder be always a new folder having current date as name of this new destination folder. i am going to use these codes as to get backup of my vba project.... Please share codes for these two doubts Sir.

  • @swarupapatil661
    @swarupapatil661 2 роки тому

    Sir, I want to copy or move files from any source folder to any destination folder.
    If i will create list in excel i.e file name, source folder, destination folder.
    File Name Soruce Folder Destination Folder
    1.xls D:\Test E:\Test\Final
    2.xlsx C:\Arun D:\Final\Report
    .
    .and so on
    so list ke hisab se A column kee file Source folder se Destination folder mai move hogi kya?

  • @rakhisaxena4352
    @rakhisaxena4352 5 років тому +1

    Thank you

    • @Exceltrainingvideos
      @Exceltrainingvideos  5 років тому

      Thanks. Please share with your friends and on social media. You can view more videos in Hindi and English at www.exceltrainingvideos.com/

  • @jojocarrillo
    @jojocarrillo 3 роки тому

    how can i copy files from folders that only have partial names in a list in excel? The sourcepath is not fully defined as example the excel list only shows WF-002232 R0 but the full path is WF-002232 R0 C2-L11 Facade Cast in Channel layout.

    • @Exceltrainingvideos
      @Exceltrainingvideos  3 роки тому

      You can use wildcard characters as shown in this video: www.exceltrainingvideos.com/how-to-transfer-data-from-one-sheet-to-another-using-wild-card-characters/

  • @brantzhang3950
    @brantzhang3950 3 роки тому

    Hi sir, really helpful video, thanks for sharing with us, have one question; I wanna move the specific PDF (file name contains risk rating) how can I add this ?

    • @Exceltrainingvideos
      @Exceltrainingvideos  3 роки тому

      Just like you learnt in the tutorial. You can also use 'move'.

    • @MR-ql9eb
      @MR-ql9eb 3 роки тому

      @@Exceltrainingvideos sir, I am trying to combine PDFs in a Folder with names (for example 123456_1, 123456_2, 234567_1, 234567_2, 345678_1, 345678_2). I want to combine 123456 prefix named PDFs as one set to merge and 234567 prefix named PDFs as one set, and so on. There are many sets in the Folder. I want a automate tool or app or excel macro to complete my job at a glance. Please help on this. Thank you.

    • @kunalkshirsagar3798
      @kunalkshirsagar3798 2 роки тому

      @@MR-ql9eb hi, I am also working on similar task, did you find any solution, can you please share?

  • @aset012585
    @aset012585 4 роки тому +1

    Hello, thank you for your video. Its working on my first macro run. but im just wondering, if i need to re-run the macro daily to copy the new files from source folder, will it still copy those files already copied from first macro run?
    Will it overwrite the files on my second macro run?

    • @Exceltrainingvideos
      @Exceltrainingvideos  4 роки тому

      That will depend on the logic of your macro. You can clear the contents of the worksheet before copying according to your requirements. This web link will guide: www.exceltrainingvideos.com/transfer-specific-data-from-one-worksheet-to-another-for-reports/

  • @link_2_learn
    @link_2_learn 5 років тому

    hello sir i like your vba videos. I just want to confirm. if i want to copy all folder and its contents which syntax i should use? and is there way compare files folder and file which have already been transferred to destination?

  • @praveenj000
    @praveenj000 6 років тому

    thanks for your video,
    i have a 2 questing please find below.
    1)for source path and destination path can we refer the cell in the excel? instead of writing the full path in the code. if i paste the path in the cell.
    2) if my folder is a shared folder how can i define the source path in a code.
    kindly educate me with the sample code thanks in advance.

    • @Exceltrainingvideos
      @Exceltrainingvideos  6 років тому

      1) Yes
      2) Try path to the shared folder

    • @user-cs7th6ud8g
      @user-cs7th6ud8g 5 років тому

      hi , currently im facing this problem too. may i know how u define the path for a shared folder .
      highly appreciate your help.

  • @saravananbe19
    @saravananbe19 7 років тому

    Sir any book u written or u have regarding vba program . I need examples with vba program pls help

  • @ibrahim_099
    @ibrahim_099 2 роки тому

    Can you do it for MS Access please ?

  • @360prashant
    @360prashant 4 роки тому

    Dear sir, i have already tried this code . but i need to copy paste only specific files base on the file names mentioned in excel. please help me with this

    • @Exceltrainingvideos
      @Exceltrainingvideos  4 роки тому

      This link will help: www.exceltrainingvideos.com/copy-specific-files-from-folder-and-subfolders-into-destination-folder/
      Change the IF condition to your requirements.

  • @Artistram3d1
    @Artistram3d1 3 роки тому

    This is SO powerful!. What should a person study if they wanted to learn more on this subject? I'm no coder, but I'm willing to learn this to help me at work, to copy .pdf files from individual folders (sometimes over 100) into a folder named _PROOFS. I work on a Mac, is the workflow any different? Bless you for sharing your expertise.

    • @Exceltrainingvideos
      @Exceltrainingvideos  3 роки тому +1

      This link will make it easier to work on a Mac: www.macexcel.com/examples/filesandfolders/copyfile/

    • @Artistram3d1
      @Artistram3d1 3 роки тому

      @@Exceltrainingvideos Thank you, Guru!

  • @debrasavoie1446
    @debrasavoie1446 4 роки тому

    Thank you. I learned quite a bit. I am trying to use Access VBA to use a field name in a table to use as the file name as I have many of same type, but only need certain ones each month. Can you help.

  • @anhnhatnguyet4628
    @anhnhatnguyet4628 3 роки тому

    copy multiple files in 1 directory to many other folders. When running the code, a scan message box appears, select the address containing multiple destination folders, ok, a message box appears to select files to copy, you can select 1 or more files. Do you have any vba code that can execute something like this description?

  • @liuwayne9686
    @liuwayne9686 5 років тому

    Hi Sir, I don't think this is copying specific files, what if I want *xxx*.xlx, for example there are many excel files and I only want to copy 2 specific files, can we actually do that using VBA?

  • @MohAboAbdo
    @MohAboAbdo 5 років тому

    Thanks ... Thanks ... Thanks

  • @hemantsingh2101
    @hemantsingh2101 7 років тому

    Hello Sir, I'm a learner and I want to know if you have any video for excel formulas, because I have not good knowledge of formulas I mean how to use or work or formulas, actually I know many formulas but I'm not good to use them I am not good to know that which formulas I have to use and where it can work..Please send me link if there is any video about my query and also I want learn how make a good and beautiful dashboard...please help.Excuse for any mistake bcoz my English is not good.Thank you Sir :-)

  • @Maanik_baadshah
    @Maanik_baadshah 3 роки тому

    Can we have the specific files based on file names instead of extension? Like storing the specific list in excel and based on the list, it selects, copies or cuts and pastes those specific files into destination folder?

  • @divyamitsonkar944
    @divyamitsonkar944 7 років тому

    Sir please provide vedio to create many folders into many zip files.Thank you

  • @shashikalagangappa4735
    @shashikalagangappa4735 7 років тому

    hi sir good morning
    kindly confirm how to edit subject line in recorded macro

  • @saikrishnamandala7667
    @saikrishnamandala7667 4 роки тому

    Hi Sir,
    I need your help to automate the below query.
    I receive files with different project names on a daily basis and I have to move them manually to other subfolders (target) based on project name.
    Example:
    Files in Source Folder
    123
    234
    567
    Folders in Destination Folder
    123
    234
    567
    I have to move these files to destination subfolders based on file name.
    Thanks in advance.

    • @Exceltrainingvideos
      @Exceltrainingvideos  4 роки тому

      There are many ways of to copy or move files from one folder to another. A good method is described here: www.exceltrainingvideos.com/copy-specific-files-from-folder-and-subfolders-into-destination-folder/
      It's a good idea to do some research yourself on this channel or our website www.exceltrainingvideos.com

  • @venkatamahesh6142
    @venkatamahesh6142 5 років тому

    Hi Dinesh i liked the video you have presented but i have an issue with my source folders which are presented on the network share drive and i should copy all these files will the help of multiple hyperlinks since i have different multiple hyperlinks as source folder. could you help me out in this

  • @karthikeyanpushparaj8709
    @karthikeyanpushparaj8709 4 роки тому

    Hi sir, above extract only xlm files, what should do for extract all type of files.

    • @Exceltrainingvideos
      @Exceltrainingvideos  4 роки тому

      Watch the video and refer to www.exceltrainingvideos.com/copy-specific-files-or-all-files-from-source-folder-to-destination-folder-with-vba/

    • @karthikeyanpushparaj8709
      @karthikeyanpushparaj8709 4 роки тому

      Thanks you sir, how to remove temp files, while copying file names in a folder.

  • @jeffgeofrey4140
    @jeffgeofrey4140 3 роки тому

    Hi sir,
    I have a list of folder name in excel file,
    Excel file cell value have some data which is same as the source folder name,
    In source folder there are many folders are there,
    But I required only few which is available in the excel file to another destination...
    Is this VBA is helpful???
    Please support sir...

    • @Exceltrainingvideos
      @Exceltrainingvideos  3 роки тому

      Yes. For the folder name(s) you can assign the Range or Cell.

    • @jeffgeofrey4140
      @jeffgeofrey4140 3 роки тому

      @@Exceltrainingvideos
      Hi
      To asign the cell at where????
      Any idea. Please help.

    • @jeffgeofrey4140
      @jeffgeofrey4140 3 роки тому

      Hi sir
      Any update on this.?

    • @Exceltrainingvideos
      @Exceltrainingvideos  3 роки тому

      These links will guide:
      www.exceltrainingvideos.com/save-excel-files-automatically-using-cell-data/
      www.exceltrainingvideos.com/refer-cells-using-index-numbers-vba/
      www.exceltrainingvideos.com/refer-to-excel-cells-using-range-object/

  • @mayur_7
    @mayur_7 3 роки тому

    Sir pls tell how to transfer specific sub folders to destination folder

    • @Exceltrainingvideos
      @Exceltrainingvideos  3 роки тому

      www.exceltrainingvideos.com/copy-specific-files-from-folder-and-subfolders-into-destination-folder/

  • @BD_Monk
    @BD_Monk 6 років тому

    Hi Sir,
    Can you please help me. I'm writing my problem below.
    Say suppose I have a excel file where in A column there is some folder names say 1234, 2345, 3456, 4567 and so on. And in the B column we have output folder names say home, field, road, jungle. So, 1234 folder will get copied to home folder 2345 folder will get copied to field folder and so on. And all the A column data will be in a dump folder. How will I create it. Please help

  • @satyenpurohit3947
    @satyenpurohit3947 7 років тому

    What if we want to copy active workbook (work book which is already open) to destination folder

    • @Exceltrainingvideos
      @Exceltrainingvideos  7 років тому

      You can't copy an open file. Since you're most probably working on it, you can save it.

    • @satyenpurohit3947
      @satyenpurohit3947 7 років тому

      Dinesh Kumar Takyar , Sir, so you mean we have use save as function to copy that file to destination folder

  • @TheJITESHMALLI
    @TheJITESHMALLI 4 роки тому

    Getting "runtime error:70 , permission denied" when trying to copy a specific file

    • @Exceltrainingvideos
      @Exceltrainingvideos  4 роки тому

      The file might be password protected.

    • @TheJITESHMALLI
      @TheJITESHMALLI 4 роки тому

      @@Exceltrainingvideos No, i tried with normal .rar and .xlsx files and got the same error but when i used file extn. ".xlsx", all the files got transferred. So the issue is particularly when i am trying to transfer a specific file.

  • @GoosebumpsLoaded
    @GoosebumpsLoaded 4 роки тому

    Object doesn't support this property the error I am getting

    • @Exceltrainingvideos
      @Exceltrainingvideos  4 роки тому

      Before you start using the File Object System or FSO in VBA you need to activate a reference of Microsoft Scripting Runtime Library : www.exceltrainingvideos.com/copy-specific-files-or-all-files-from-source-folder-to-destination-folder-with-vba/

  • @sudarshanpotle1582
    @sudarshanpotle1582 4 роки тому

    Hello Sir
    As I have given path of a folder from my Desktop
    But still I m getting Run Time Error 76 : Path Not Found
    sourcePath = "C:\Users\EM-PC1\Desktop\REPORTS"
    destinationPath = "C:\Users\EM-PC1\Desktop\New folder\"

    • @Exceltrainingvideos
      @Exceltrainingvideos  4 роки тому

      Isn't something missing in your source path?

    • @sudarshanpotle1582
      @sudarshanpotle1582 4 роки тому

      @@Exceltrainingvideos no nothing I cross checked it and even copy pasted the path

    • @Exceltrainingvideos
      @Exceltrainingvideos  4 роки тому

      Did you use this part of the code:
      If Right(sourcePath, 1) “\” Then
      sourcePath = sourcePath & “\”
      End If
      If not, then your sourcepath needs correction with a "\",

    • @sudarshanpotle1582
      @sudarshanpotle1582 4 роки тому

      @@Exceltrainingvideos yes I have taken your code as it is, just changed the source and destination path nothing else changed

    • @Exceltrainingvideos
      @Exceltrainingvideos  4 роки тому

      "I have given path of a folder from my Desktop": the path should look like this - C:\Users\yourname\Desktop...

  • @dwaipayandattaroy457
    @dwaipayandattaroy457 5 років тому

    Hi Sir,
    How can I copy a file from remote machine to local machine using macro

    • @Exceltrainingvideos
      @Exceltrainingvideos  5 років тому

      If you have the rights to log on to the remote machine and access the file you should be able to copy the data in the usual manner.

  • @harithav4799
    @harithav4799 4 роки тому

    Sir i want to coy all the file not only.xl files how to do sir

  • @pmditindia8694
    @pmditindia8694 5 років тому

    i am getting Runtime error 424 Object Required. how can i fix it

    • @Exceltrainingvideos
      @Exceltrainingvideos  5 років тому

      Check your code carefully. This link will help: www.exceltrainingvideos.com/copy-specific-files-or-all-files-from-source-folder-to-destination-folder-with-vba/

  • @vikkysharma473
    @vikkysharma473 4 роки тому

    In column A I have file name
    In column B I have source folder
    In column C i have destination folder
    Need a macro
    To copy files of column A
    From source path (columnB)
    To destination path (columnC)

    • @Exceltrainingvideos
      @Exceltrainingvideos  4 роки тому

      You just saw the video to solve the problem. This link will help further: www.exceltrainingvideos.com/copy-specific-files-or-all-files-from-source-folder-to-destination-folder-with-vba/

    • @mahmartins7602
      @mahmartins7602 4 роки тому

      I have a code to do that, send do different destinations, but now they are hardcoded. I am still looking for a code to read from the main table where is the destination of each file