Moving files based on the value of a cell?

shannonmarie111

New Member
Joined
Jan 22, 2015
Messages
15
Hi everyone. I'm really new to this kind of stuff but mu boss has asked me to come up with something. I have a spreadsheet with file names in column A and either a "Y" or a "N" in column B. All the files that correspond to he file names are in folder "C:\copyfrom". If the value in column B is "Y", I need to either copy or move (they don't really care which) that file to "C:\moveto". I have been looking at code I see online forever,trying to manipulate it so this works and am having zero luck. Can anyone help me? Thank you!!
 
1. Can you post what your data in column A looks like?
2. Are your "y's" in column B in lower ot upper case?

To easily get the it right, please post sample data

Here is what I have:

00~BERKS~000000~Target Condo~Other~Other n
01~BERKS~000000~Target Condo~MISC~Miscellaneous Documents y
02~BERKS~000000~Target Condo~MISC~Miscellaneous Documents n
03~BERKS~000000~Target Condo~MISC~Miscellaneous Documents n
04~BERKS~000000~Target Condo~MISC~Miscellaneous Documents y
05~BERKS~000000~Target Condo~MISC~Miscellaneous Documents y
06~BERKS~000000~Target Condo~MISC~Miscellaneous Documents y
07~BERKS~000000~Target Condo~MISC~Miscellaneous Documents y
08~BERKS~000000~Target Condo~MISC~Miscellaneous Documents n
09~BERKS~000000~Target Condo~MISC~Miscellaneous Documents y
10~BERKS~000000~Target Condo~MISC~Miscellaneous Documents n
 
Upvote 0

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
If i were to take a guess, it might be because your filenames don't have extensions at the end.

Like the code recognises "koala.jpg" but not "koala". But then again, if it can't locate the file, the code should error out and not just run and do nothing

Are all your files of same extension? and what type of files are they actually
 
Upvote 0
If i were to take a guess, it might be because your filenames don't have extensions at the end.

Like the code recognises "koala.jpg" but not "koala". But then again, if it can't locate the file, the code should error out and not just run and do nothing

Are all your files of same extension? and what type of files are they actually

They are all PDF files. I can add the pdf extension on to the file names in the spreadsheet and then run it again.
 
Upvote 0
There's no reason why it would copy files selectively. If it moved/copied some, then the code does work

Can you confirm that the files it fails on actually exist?
 
Upvote 0

Forum statistics

Threads
1,215,972
Messages
6,128,032
Members
449,414
Latest member
sameri

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