+ Reply to Thread
Results 1 to 2 of 2

Replace Workbook in Folder Without Overwriting Certain Data

  1. #1
    Registered User
    Join Date
    08-24-2007
    MS-Off Ver
    14.0
    Posts
    69

    Replace Workbook in Folder Without Overwriting Certain Data

    Hi Everyone,

    I have an excel workbook which I pull from the internet daily. I have to modify records in that workbook, particularly in the "ID" column, before I drop the workbook in a file folder on my computer drive. I would like the ability drop the next workbook in the folder, replacing the workbook already there, but not the changes made to that existing workbook. I am somewhat familiar with VBA. Any direction on how to do this would be much appreciated!

    Thank you.

    -Tommy

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Replace Workbook in Folder Without Overwriting Certain Data

    replacing the workbook already there, but not the changes made to that existing workbook.
    This is such a contradiction that I can only assume that I don't understand the question. Replacing a workbook replaces the workbook. Perhaps more detail would help.

    Let me try to paint the scenario that you may be trying to describe.

    You copy a file from the Internet. Let's call that Version A. You make edits. You save it in your folder. Let's call it Version B.

    The next day, you get a new version of that same workbook from the Internet, and also edit that new version. Let's call that Version C. Version C has your new edits, but not the edits you made yesterday in Version B. You want to merge yesterday's edits in Version B into today's edits in Version C, and then save Version C, replacing Version B.

    The coding part isn't terribly hard but if I understand correctly, here is the problem you need to solve. Suppose you complete your changes to create Version C, and now you compare it to Version B from yesterday. You find that there is a cell that has one value in Version B, and a different value in Version C. You don't know if:

    1. You changed the cell when you created Version B, and now Version C shows the value as it was taken from the Internet. You need to keep the change made in Version B.
    2. There were no changes to this cell until you created Version C, and you can use the value from Version C.
    3. You didn't make any changes at all, in any version, but the version you just copied from the internet to make Version C is different than Version A that you used to make Version B yesterday. You want to therefore use the latest value provided by the Internet, and keep Version C.
    4. You changed the value when you created Version B, and you changed it to something different when you created Version C. In this case, which one do you want to keep?


    To be able to deal with these cases you need to build a way into your file to track what changes you are making each time so you know what change takes precedence when there is a difference. To give more specific advice I would have to see the file, and understand just what things you change.
    Last edited by 6StringJazzer; 04-11-2018 at 11:25 AM.
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

+ 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. Replace all data in active workbook with all data from an opened workbook
    By krisspy in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-18-2014, 04:12 PM
  2. Compare Columns and Replace Values without overwriting
    By Girish Punjabi in forum Excel General
    Replies: 1
    Last Post: 03-14-2013, 12:43 PM
  3. Help on copying and overwriting worksheets from one workbook to another
    By frankienap in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 05-04-2012, 04:56 PM
  4. Extracting data from multiple workbook in folder into main workbook
    By Julesdude in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-14-2010, 11:25 AM
  5. stop user from overwriting a workbook
    By carsto in forum Excel General
    Replies: 7
    Last Post: 06-17-2010, 09:51 AM
  6. copying worksheets from one workbook to another and overwriting if they exist already
    By tinkerbelle in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-19-2010, 08:55 AM
  7. Shared workbook overwriting
    By Reidm in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-03-2008, 09:58 AM
  8. 1.Open workbook. 2 copy data. 3 replace data. 4 save workbook.
    By Cristobalitotom in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-05-2006, 07:24 PM

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