I want to copy files from one directory to several others, i (with searching help and ready code) succeeded in doing that, the problem is : the macro waits till it finishes copying all files from source to destination 1, then start copying to destination 2 I want either to: copy the 1st source to all destinations at the same time then moves to source 2 OR start copying all source files to destination 1 then moves to start copying all source files to destination 2 without waiting:
I use the following to code to copy:
Sub All()
<code>For Each C In Worksheets("Path").Range("A2:A21")
If C.Value = "" Then GoTo 1
Call CopyFolder
Application.ScreenUpdating = True
Next C</code> 1
End Sub
==========================================
Sub CopyFolder()
<code>Dim fso As Object
Dim FromPath As String
Dim ToPath As String
FromPath = "C:\video"
ToPath = C & ":\video"
If Right(FromPath, 1) = "\" Then
FromPath = Left(FromPath, Len(FromPath) - 1)
End If
If Right(ToPath, 1) = "\" Then
ToPath = Left(ToPath, Len(ToPath) - 1)
End If
Set fso = CreateObject("scripting.filesystemobject")
If fso.FolderExists(FromPath) = False Then
MsgBox FromPath & " doesn't exist"
Exit Sub
End If
fso.CopyFolder Source:=FromPath, Destination:=ToPath</code>
End Sub
Thanks
I use the following to code to copy:
Sub All()
<code>For Each C In Worksheets("Path").Range("A2:A21")
If C.Value = "" Then GoTo 1
Call CopyFolder
Application.ScreenUpdating = True
Next C</code> 1
End Sub
==========================================
Sub CopyFolder()
<code>Dim fso As Object
Dim FromPath As String
Dim ToPath As String
FromPath = "C:\video"
ToPath = C & ":\video"
If Right(FromPath, 1) = "\" Then
FromPath = Left(FromPath, Len(FromPath) - 1)
End If
If Right(ToPath, 1) = "\" Then
ToPath = Left(ToPath, Len(ToPath) - 1)
End If
Set fso = CreateObject("scripting.filesystemobject")
If fso.FolderExists(FromPath) = False Then
MsgBox FromPath & " doesn't exist"
Exit Sub
End If
fso.CopyFolder Source:=FromPath, Destination:=ToPath</code>
End Sub
Thanks