+ Reply to Thread
Results 1 to 2 of 2

Copying list of files to different folders VBA

Hybrid View

  1. #1
    Registered User
    Join Date
    01-31-2017
    Location
    Calgary, Alberta
    MS-Off Ver
    MS2007
    Posts
    1

    Copying list of files to different folders VBA

    Hi,

    I have a list of files in my spreadsheet (column B) with their paths, ie. C:\Temp\test1.txt, C:\Temp\test2.txt and I want to copy them into a destination folder specific to each file (folders are already created) and paths are in column C. Ie. C:\Temp\folder1, C:\Temp\folder2

    Is there an easy way to do this in VBA. All I can find is code to copy multiple files in one folder to another specific folder.

    Thanks.

  2. #2
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    MS365 V.2406
    Posts
    2,310

    Re: Copying list of files to different folders VBA

    Possibly...
    Sub CopyFiles()
    'Assumes files are not open
    Dim rCell As Range
    
    For Each rCell In Range("B1:B" & Cells(Rows.Count, "B").End(xlUp).Row)
         Filecopy (source:=rcell, destination:=rcell.offset(0,1))
    End Sub
    Last edited by dangelor; 01-31-2017 at 01:51 PM.

+ 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. List all folders/files?
    By Macmanzx2000 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-10-2015, 05:55 AM
  2. [SOLVED] Copying files and folders
    By LAVA2 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-25-2015, 05:23 PM
  3. Replies: 0
    Last Post: 10-15-2014, 04:37 AM
  4. Searching folders for list of files
    By joltremari in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-03-2014, 02:09 PM
  5. List files in folders in excel
    By jayblack in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 05-21-2010, 07:25 AM
  6. copying files between folders
    By mqdias in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-26-2007, 09:37 AM
  7. Map/List of folders, subfolders & files
    By Bogdan in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-11-2006, 01:10 PM

Tags for this Thread

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