+ Reply to Thread
Results 1 to 6 of 6

Macro to copy workbooks to another folder

  1. #1
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    2,725

    Macro to copy workbooks to another folder

    I have written code to copy workbooks with .xlsm extensions and containing text Sales_Ledger from C:\users\howard\downloads to C:\sales ledgers

    examples of file names below to be copies

    BRMES Sales_Ledger RECON AUG.xlsm, BRSAU Sales_Ledger RECON AUG.xlsm etc


    However no files are being copied


    It would be appreciated if someone could kindly check & amend my code




    Please Login or Register  to view this content.

  2. #2
    Valued Forum Contributor rollis13's Avatar
    Join Date
    01-26-2012
    Location
    Cordenons
    MS-Off Ver
    Excel 2016 32bit - Win 11
    Posts
    917

    Re: Macro to copy workbooks to another folder

    Change this part of your macro:
    Please Login or Register  to view this content.
    The comparison should be with both names LCase and you could avoid the last jolly * or use .xls* if necessary).
    Then to copy files the function is FileCopy and you are missing a path delimiter.

  3. #3
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    2,725

    Re: Macro to copy workbooks to another folder

    Thanks for the help.


    when running the macro, only one workbook containing text "Sales_Ledger" is being copied to the folder C:\sales Ledgers

    I can't understand why all the workbooks containing Sales_Ledger is not being copied

    It would be appreciated if you could kindly check and advise

  4. #4
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: Macro to copy workbooks to another folder

    Please Login or Register  to view this content.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  5. #5
    Forum Contributor
    Join Date
    07-12-2018
    Location
    South Africa
    MS-Off Ver
    Office 2021
    Posts
    2,725

    Re: Macro to copy workbooks to another folder

    Thanks Sintek

    Code works perfectly

  6. #6
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: Macro to copy workbooks to another folder

    Glad I could contribute...tx for rep +

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] macro to copy workbooks from Folder into the appropriate sub-folder
    By Howardc1001 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-13-2021, 02:24 AM
  2. [SOLVED] Macro to Copy .xlsm workbooks from folder and sub-solder
    By Howardc1001 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-28-2019, 04:56 AM
  3. [SOLVED] Copy Range from multiple Workbooks in folder, to Summary Workbook also in same folder?
    By xlyfe in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-24-2018, 01:22 PM
  4. VBA Copy macro-enabled worksheets to all workbooks in folder
    By Kahmed2R in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-30-2013, 09:59 AM
  5. create a compressed folder or zipped folder then copy workbooks to it.
    By Ironman in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-04-2012, 03:56 PM
  6. copy all workbooks in a folder to a different workbook
    By prajesh in forum Excel General
    Replies: 6
    Last Post: 11-22-2011, 01:35 AM
  7. Macro - Copy 3 cells from all workbooks in a folder
    By misterzr in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-24-2010, 09:43 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1