Modification to a date sync macro

Posted on 2012-09-10
Last Modified: 2012-09-11
Several years ago an EE expert wrote a macro for me that synchronized dates and corresponding values in two files.  The macro assigned a value of zero to correspond with any date in the "A" file that wasn't in the "B" file".  I want to modify this macro so that instead of assigning a zero value, it assigns the previous value in the list.


20120905     20120905    5
20120906     20120907    4

At present the result of running the macro is this:

20120905     5
20120906     0
20120907     4

What I now want is this:

20120905     5
20120906     5
20120907     4

I've attached the current macro.  Can someone tell me how to change the code to accomplish my objective.  Thanks.
Question by:pwflexner
    LVL 5

    Accepted Solution

    In the second For Each loop, change this line of code:

    cell2 = 0


    celle2 = celle2.Offset(-1, 0).Value

    Author Closing Comment

    Perfect.  Thanks!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
    Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
    The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
    This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now