+ Reply to Thread
Results 1 to 6 of 6

Copy, Rename and validate multiple excel files

  1. #1
    Registered User
    Join Date
    09-07-2020
    Location
    Melbourne
    MS-Off Ver
    10
    Posts
    3

    Post Copy, Rename and validate multiple excel files

    Hi All, Been scratching around for the last 5 days to find something that works for multiple files. Many a late night/early hours of the morning unsuccessfully piecing together/coding to get a result.
    Thanks in advance.

    The following code is from get-digital-help.com/copyrename-a-file-excel-vba written by Oscar
    I'd really like each row to look at the source path, source file name, destination path and destination file:

    For each row:
    Column A list the source path
    Column B lists the source file name
    Column C lists to destination path
    Column D lists the new file name

    Column E writes "Success" or "Fail" validation.
    - if file name already exists in destination, then "Fail"
    - If source file doesn't exist, then "Fail"


    Nice to have/completely optional!!!
    Check if source file column A&B exists, = True or False in column F. Where True, then proceed with copy and rename.
    If destination file already exist, the fail and column F = duplicate


    Please Login or Register  to view this content.
    Last edited by Bart101; 09-08-2020 at 07:12 PM.

  2. #2
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,236

    Re: Copy, Rename and validate multiple excel files

    Hi Bart101

    Welcome to our Forum...

    Please take a moment to read our forum rules...here
    Your post does not comply with Rule # 2
    2. Programming code must be enclosed in code tags to improve readability. (A, Z)
    Please Login or Register  to view this content.
    So...Edit your post...Highlight the code and press the # button
    We can only assist once this has been done…Also, see Top yellow banner about uploading a sample file showing expected result...
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  3. #3
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Copy, Rename and validate multiple excel files

    As explained by Sintek, code is much easier to read if contained in code tags - as can be seen in my reply below
    I have not used your code preferring to start from scratch

    Run this first to see if I have understood the logic of your data
    Refer to image below and let me know what differs in your data if you encounter a problem
    Please Login or Register  to view this content.
    See result of Debug.Print in VBA immediate window (made visible with View \ Immediate Window)

    If the first test works out, then run this
    Please Login or Register  to view this content.
    Attached Images Attached Images
    Last edited by kev_; 09-08-2020 at 06:27 AM.
    Click *Add Reputation to thank those who helped you. Ask if anything is not clear

  4. #4
    Registered User
    Join Date
    09-07-2020
    Location
    Melbourne
    MS-Off Ver
    10
    Posts
    3

    Re: Copy, Rename and validate multiple excel files

    Hi Kev, thanks for the fast response.
    Ran the test and seemed to produce the required logic.
    Ran the second one and produced a compile error with no validation comments.

    First time using these type of forums.

    In the mean time, I'd received a response/solution from someone else in another forum.
    Done some extensive testing and tweaking with the developer which works really well.
    Are you interested or am I allowed to post a link to the solution in the other forum to ensure credit or recognition is provided to the correct person?
    Last edited by Bart101; 09-08-2020 at 11:34 PM.

  5. #5
    Forum Expert
    Join Date
    11-22-2016
    Location
    Cornwall,UK
    MS-Off Ver
    office 365
    Posts
    4,240

    Re: Copy, Rename and validate multiple excel files

    You could read the forum rules - you agreed to them when you signed up and have already broken 2 of them in your first thread Links of crossposting in other forum should be given and the other forum would expect the same courtesy

    This thread may of benefit to future users, so post your solution with link to the crossposted thread
    Glad you have a solution

  6. #6
    Registered User
    Join Date
    09-07-2020
    Location
    Melbourne
    MS-Off Ver
    10
    Posts
    3

    Re: Copy, Rename and validate multiple excel files

    Quote Originally Posted by kev_ View Post
    This thread may of benefit to future users, so post your solution with link to the crossposted thread
    Glad you have a solution
    Tkx Kev, seems it wont allow me to post the link until I've had a few more posts so here is the shortened version: stackoverflow.com/questions/63785886

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Ability to rename multiple files from a path and move and rename to another.
    By X82 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-20-2020, 09:54 PM
  2. Rename Multiple PDF Files using Excel VBA
    By swithinmurickal in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-07-2018, 01:21 PM
  3. Rename Multiple PDF files in a folder per the list in Excel spreadsheet
    By vmanil75 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-18-2017, 09:40 AM
  4. [SOLVED] Copy/Rename Multiple files in Excel
    By chris619 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-13-2017, 02:44 PM
  5. [SOLVED] rename multiple excel files as per its own cell value A2
    By raj soni in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 09-11-2017, 01:55 AM
  6. [SOLVED] Copy/Rename Multiple files using Excel values in columns
    By felizeng in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-25-2017, 10:52 AM
  7. How to copy and rename files in vba by searching multiple folders for files
    By razorace in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-04-2014, 04:21 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1