Consulting

Results 1 to 5 of 5

Thread: Solved: Two versions of one project -- oops!

  1. #1
    VBAX Regular
    Joined
    Jan 2007
    Location
    Dallas area
    Posts
    74
    Location

    Solved: Two versions of one project -- oops!

    I've been working on a large project for quite some time, careful to save with a new file name after each major bit of work. MyProject001.xls, MyProject002.xls, etc.

    Well, I goofed. Don't ask me how, it's too foolish to go into. But from MyProject035.xls, there are now two successor files, each of which has some (different) new additions, call them MyProject036CoolCode.xls, and MyProject036NewStuff.xls. Yeah, really, really clever, I know.

    Is there a way to compare the two 036 versions and find out where code that isn't the same in them resides? Most of the changes are in big blocks in separate places, and it won't be hard to put them back together into a 037 version that has the new stuff from both of the 036's, but I'd really like to make sure I don't miss tiny little changes that I made somewhere else.

    Anybody know of a tool or method to see where the code in the two spreadsheet files differs? (The data in the worksheets is significantly different, but that's not a concern, just where the differences are in the code.)

    Many thanks,

    G.T.

  2. #2
    Administrator
    Chat VP
    VBAX Guru johnske's Avatar
    Joined
    Jul 2004
    Location
    Townsville, Australia
    Posts
    2,872
    Location
    Not that I know of - but a simple way is to copy the code from the procedure (or code module) in one workbook. Select A1 on a worksheet and paste.

    Now copy the code from the same procedure (or code module) in the other workbook and select (say) I1 on the same worksheet and paste.

    Now insert this formula
    =(A1=I1)
    in the first row of another column and fill down - you then get TRUE if each line's the same, and FALSE if they're not.

    EDIT: I could do a VBA procedure to do this for you but it seems unnecessary just for a "one-off" thing.
    You know you're really in trouble when the light at the end of the tunnel turns out to be the headlight of a train hurtling towards you

    The major part of getting the right answer lies in asking the right question...


    Made your code more readable, use VBA tags (this automatically inserts [vba] at the start of your code, and [/vba ] at the end of your code) | Help those helping you by marking your thread solved when it is.

  3. #3
    The VBE also has the capability of tiling code windows, so I would:

    - open the two files
    - close all their code windows
    - open two same modules
    - close project explorer and props window
    - window, tile vertically
    Regards,

    Jan Karel Pieterse
    Excel MVP jkp-ads.com

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    You could also export the code modules, this dumps them into text files, and use one of the many free text editors out there that does file comparisons.

  5. #5
    VBAX Regular
    Joined
    Jan 2007
    Location
    Dallas area
    Posts
    74
    Location
    Good inputs, many thanks!

    Solved.

Posting Permissions

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