Copy worksheet to various folders

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,233
Office Version
  1. 2007
Platform
  1. Windows
Hi,
I have file called INFO
I also have Folders of which all have the file INFO within.
Folders are named like so JUNE JULY AUGUST ETC ETC

As opposed to copy / paste manually to every folder can this be done using some kind of code etc
Basically i need to put the same file into each folder in one step as opposed to many times of doing the same thing.
I understand that the existing file in the folder will be replaced & that is fine,
 
I think the below is now correct with the above post request.

Rich (BB code):
Private Sub NewFileToFolders_Click()
    Dim FileName As String
    Dim SaveName As String
    Dim FromPath As String
    Dim ToPath As String
    Dim fldrArr As Variant
    Dim x      As Long
    Dim FSO    As Object
    FileName = "TESTFILE.xlsm"
    SaveName = "SUMMARY.xlsm"
    FromPath = "C:\Users\Ian\Desktop\EBAY\ACCOUNTS\"
    ToPath = "C:\Users\Ian\Desktop\EBAY\ACCOUNTS\CURRENT SHEETS\"
    fldrArr = Array("04 APRIL", "05 MAY", "06 JUNE", "07 JULY", "08 AUGUST", "09 SEPTEMBER", "10 OCTOBER", "11 NOVEMBER", "12 DECEMBER", "13 JANUARY", "14 FEBRUARY", "15 MARCH", "16 APRIL")
    On Error Resume Next
    For x = LBound(fldrArr) To UBound(fldrArr)
        Set FSO = CreateObject("Scripting.FileSystemObject")
        FSO.CopyFile Source:=FromPath & FileName, Destination:=ToPath & fldrArr(x) & "\" & SaveName
    Next x
    MsgBox "ALL FILES NOW TRANSFERED TO FOLDERS", vbInformation, "CONFIRMATION MESSAGE"
    Set FSO = Nothing
End Sub
 
Upvote 0

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Yes, that's it :). Thanks for the positive feedback(y), glad having been of some help.
 
Upvote 0

Forum statistics

Threads
1,215,501
Messages
6,125,169
Members
449,212
Latest member
kenmaldonado

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top