+ Reply to Thread
Results 1 to 6 of 6

Macro to copy and paste source file to destination file using cell value

  1. #1
    Registered User
    Join Date
    07-29-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    10

    Macro to copy and paste source file to destination file using cell value

    Hi I need a macro to copy and paste a file from source to destination specified in excel.

    Column A has the source
    Column B has destination
    Column C has status

    for example the source in cell A2 has to be copied and pasted to the destination in Cell B2 we should have a status completed or failed in column c2
    the source in cell A3 has to be copied and pasted to the destination in Cell B3 and we should have a status completed or failed in column c3
    the copying and pasting should be done till the last source and destination is available and it should continue even if it fails.

    If it fails it should continue with the next row.

    Kindly help me in the above situation.

    I have attached a sample file.
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Macro to copy and paste source file to destination file using cell value

    Try the attached file. It will probably do what you want.

    For convenience, the Macro code follows:
    Please Login or Register  to view this content.
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    07-29-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Macro to copy and paste source file to destination file using cell value

    Hi LJMetzger,

    That was really awsome

    Just one more request what if "I want to copy the source folder and paste it to the destination folder"

    Source path
    C:\Users\Owner\Documents\Lew\WindowsBatchFiles\ExcelandVba

    Destination path:
    C:\Users\Owner\Documents\Lew\

    After pasting i can find a copy of the folder ExcelandVba in the folder "Lew"

    So in the above example i want to paste the folder "ExcelandVba" in the folder "LEW". I want to paste the entire folder. After pasting i can find a copy of the folder ExcelandVba in the folder "Lew".
    Can you please help me

  4. #4
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Macro to copy and paste source file to destination file using cell value

    mani,

    Thanks for the kind words and the rep points. Both are much appreciated.

    See the attached file which adds the capability of copying folders (and all their subfolders and files). Please note that destination files that already exist are overwritten.

    Please be careful when copying folders. It could take forever or longer to recover from an incorrect Destination folder name, especially since.

    Lewis

  5. #5
    Registered User
    Join Date
    07-29-2013
    Location
    India
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: Macro to copy and paste source file to destination file using cell value

    Hi LJMetzger,

    Hey man you ROCK That was really excellent But sorry for me asking one more request. This works fine in my local machine. But we have a tricky situation where we have to upload files to a content server. generally copying files to content server takes lot of time.Can you please update me if this is possible.


    Thanks a lot for all your help till now

    Regards,
    Mani

  6. #6
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Macro to copy and paste source file to destination file using cell value

    Thanks again for the kind words. Unfortunately, this question is not in my area of expertise. I have never had a good server experience, and at the current time I don't have access to a server.

    Sorry, Good luck.

    Lewis

+ 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. Replies: 0
    Last Post: 09-26-2012, 01:15 PM
  2. Copy Data from One Source and Paste into New file
    By meyero90 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-10-2011, 01:59 PM
  3. Copy cell colour to destination file
    By Daedalusfbo in forum Excel General
    Replies: 5
    Last Post: 01-27-2011, 12:10 PM
  4. [SOLVED] How to update destination file with source files closed?
    By Alex Costache in forum Excel General
    Replies: 2
    Last Post: 08-01-2006, 05:10 AM
  5. Replies: 1
    Last Post: 10-17-2005, 04:05 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