+ Reply to Thread
Results 1 to 5 of 5

VBA Code open files in folder, copy text to workbook-Next time folder opened copy only new

  1. #1
    Registered User
    Join Date
    11-27-2012
    Location
    Portland, Oregon
    MS-Off Ver
    Excel 2007
    Posts
    81

    VBA Code open files in folder, copy text to workbook-Next time folder opened copy only new

    I have VBA code that works perfect except for one thing. Currently when I click on the button (Process Data) the code opens a folder and copies some text from all the spread sheets that are in this folder, which works great except that files are being added to this folder every day and if i click on the button (Process Data) a second time it brings in all the files I already have and any new ones which will duplicate the ones when I pushed the button the first time. I ended up adding a clear button that would remove all data and then push the (Process Data) to re-populate the spread sheet. I would like to remove the clear button.

    My question is how can I change the VBA code so if more files are added the the folder each day that it only looks at the new files that it has not already transfered data from.

    I have attached spread sheet.
    Can anyone help!
    Attached Files Attached Files

  2. #2
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: VBA Code open files in folder, copy text to workbook-Next time folder opened copy only

    Hi Bikeman

    Untested but should work
    Please Login or Register  to view this content.
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  3. #3
    Registered User
    Join Date
    11-27-2012
    Location
    Portland, Oregon
    MS-Off Ver
    Excel 2007
    Posts
    81

    Re: VBA Code open files in folder, copy text to workbook-Next time folder opened copy only

    Sorry for late responce, been on vacation.

    Trying to test your code, sorry but I'm new to using VBA code. I noticed you mention in a couple places in the code to "change this to an unoccupied cell" not sure what you mean by this? Also at the end of your code you mention "Change this line" (SourceBook.Close True) not sure I understand what to change it too.

    Sorry for my lack of knowledge on how to write code.

  4. #4
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: VBA Code open files in folder, copy text to workbook-Next time folder opened copy only

    Hi Bikeman

    This means just what it says
    Please Login or Register  to view this content.
    In your Source Worksheets find an unoccupied cell...it can be anything A1, XX1, VB256, anything you wish as long as it does not have Data you need. The code is going to write "processed" to this cell in this line of code
    Please Login or Register  to view this content.
    The next time this worksheet is processed the code will look at this cell...if it says "processed" this worksheet will be skipped.

    Ignore this comment
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    11-27-2012
    Location
    Portland, Oregon
    MS-Off Ver
    Excel 2007
    Posts
    81

    Re: VBA Code open files in folder, copy text to workbook-Next time folder opened copy only

    This works great! Thanks so much.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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