Move File from one directory to another based on 3rd column value

Adiba Qudoos

New Member
Joined
Mar 2, 2019
Messages
4
Hello everybody
I need to rename and move files from Folder A to Folder B based on some criteria

I have 3 column A, B, C
  1. Column A : contains "old/parent path"
  2. Column B : contain "new name of files"
  3. Column C : contains "new path "

I need a code of three parts
2 have been solved but at third i am stuck badly

2nd is
if column A.value is equal Column B.value then respective file from column B will be renamed only (no move).
3rd point is

if column A.value is not equal Column B.value then respective file from column B will be moved to Folder B (no rename only move).

anybody please help
 

Some videos you may like

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

Adiba Qudoos

New Member
Joined
Mar 2, 2019
Messages
4
For updating Column A, I have used a automated way using
Dim fnam As Variant
' fnam is an array of files returned from GetOpenFileName
' note that fnam is of type boolean if no array is returned.
' That is, if the user clicks on cancel in the file open dialog box, fnam is set to FALSE

Dim b As Integer 'counter for filname array
Dim b1 As Integer 'counter for finding \ in filename
Dim c As Integer 'extention marker

' format header
Range("A1").Select
ActiveCell.FormulaR1C1 = "Path and Filenames ( Old )"
Range("A1").Select
With Selection.Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 10
End With
Columns("A:A").EntireColumn.AutoFit
Range("b1").Select
ActiveCell.FormulaR1C1 = "Path and Filenames ( New )"
Range("b1").Select
With Selection.Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 10
End With
Columns("b:b").EntireColumn.AutoFit
Range("C1").Select
ActiveCell.FormulaR1C1 = "Input New Filenames Below"
Range("C1").Select
With Selection.Font
.Name = "Arial"
.FontStyle = "Bold"
.Size = 10
 

Watch MrExcel Video

Forum statistics

Threads
1,114,337
Messages
5,547,355
Members
410,785
Latest member
phillippaige
Top