Rayne
asked on
Hello Gurus
Hello All,
i have a VBA question -
A) These are 3 folders in a drive with folder names following the naming convention like below…
C:\WW\2014.09.09 DA 10 XLS
C:\WW\2014.10.09 DA 11 XLS
C:\WW\2014.11.12 DA 12 XLS
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----
B) Now there is an excel file (“MAIN”) that has info like below – this basically tells which account belongs in which cycle respectively….
Account | Cycle
Ac1 | 10
Ac2 | 10
Ac3 | 11
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- -
C) Now in a certain separate folder (C:\RAW\) - there are multiple xls files (specific to accounts) with naming convention such that it has the [account] names included in their filename like this:
Fl_Ac1.xls
fl_Ac2.xls
fl_Ac3.xls
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ----
I need VBA to do the following – what macro can I give in the file of step B so that on pressing the button, it loops through the multiple files in folder C:\RAW\ and then looks up the account name in list of sheet A (step B) and then locates the cycle ID, to finally put that file in the respective destination folder in C:\WW\ ---
For example – if the code loops through the file fl_Ac1.xls – it looks up the cycle ID for Ac1 in “MAIN” file and finds that cycle is 10 – then it copies the file – fl_Ac1.xls into the folder C:\WW\2014.09.09 DA 10 XLS folder….
Thank you
Rayne
Book1.xlsx
i have a VBA question -
A) These are 3 folders in a drive with folder names following the naming convention like below…
C:\WW\2014.09.09 DA 10 XLS
C:\WW\2014.10.09 DA 11 XLS
C:\WW\2014.11.12 DA 12 XLS
--------------------------
B) Now there is an excel file (“MAIN”) that has info like below – this basically tells which account belongs in which cycle respectively….
Account | Cycle
Ac1 | 10
Ac2 | 10
Ac3 | 11
--------------------------
C) Now in a certain separate folder (C:\RAW\) - there are multiple xls files (specific to accounts) with naming convention such that it has the [account] names included in their filename like this:
Fl_Ac1.xls
fl_Ac2.xls
fl_Ac3.xls
--------------------------
I need VBA to do the following – what macro can I give in the file of step B so that on pressing the button, it loops through the multiple files in folder C:\RAW\ and then looks up the account name in list of sheet A (step B) and then locates the cycle ID, to finally put that file in the respective destination folder in C:\WW\ ---
For example – if the code loops through the file fl_Ac1.xls – it looks up the cycle ID for Ac1 in “MAIN” file and finds that cycle is 10 – then it copies the file – fl_Ac1.xls into the folder C:\WW\2014.09.09 DA 10 XLS folder….
Thank you
Rayne
Book1.xlsx
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER