I have some files in Folder1, i want to move some file to Folder2, if folder2 does not exist i wants to create same.

Files to move is mentioned in col.A, Folder1 path is mentioned in col. b & Folder2 path is mentioned in col.c

I tried this code, but not working.

[VBA]
Sub Move_Files()
'This will move Excel files from FromPath to ToPath.
'Note: It will create the folder ToPath

Dim FSO As Object
Dim FromPath As String
Dim ToPath As String
Dim FileExt As String
Dim FNames As String
Dim b As Variant
Dim c As Variant
Dim r As Variant


Set FSO = CreateObject("scripting.filesystemobject")

For r = 10 To Range("A65536").End(xlUp).Row
FileExt = Range("A" & r).Value

For b = 10 To Range("b65536").End(xlUp).Row
FromPath = Range("B" & b).Value
If Right(FromPath, 1) <> "\" Then
FromPath = FromPath & "\"
End If

For c = 10 To Range("c65536").End(xlUp).Row
ToPath = Range("C" & c).Value
If Right(ToPath, 1) <> "\" Then
ToPath = ToPath & "\"
End If

FNames = Dir(FromPath & FileExt)
If Len(FNames) = 0 Then
FSO.CreateFolder (ToPath)
'This will write File Name in Errors sheet if this does not exist

Sheets("Error").Select
Range("B65536").End(xlUp).Select
ActiveCell.Offset(1, 0).Activate
Application.CutCopyMode = False
ActiveCell.Value = FileExt
ActiveCell.Offset(1, 0).Activate
Sheets("Sheet1").Select
End If

FSO.MoveFile Source:=FromPath & FileExt, Destination:=ToPath
On Error Resume Next
Next b
Next c
Next r


End Sub

[/VBA]


Pl help

I have also attached excel file.