+ Reply to Thread
Results 1 to 4 of 4

Macro to copy information from one version to another

Hybrid View

  1. #1
    Registered User
    Join Date
    01-26-2011
    Location
    Canada
    MS-Off Ver
    Office 365
    Posts
    49

    Macro to copy information from one version to another

    Good Afternoon,

    I please need your help with automating an otherwise colossal task.

    So I have two version of an Excel tool:

    - Version 1.4, already populated by our stores resulting in 304 different files
    - Version 1.5, blank and recently updated to include several changes from the previous version

    I need to change the 304 different workbooks that are 1.4, to version 1.5. They are all saved in the same folder. I have made changes via macro before, but all of them were change something in the existing file, save it, close it, move on to the next in the folder. There were too many changes to the original file to do a change macro, rather than a new workbook. Here is what I'd like to accomplish:

    1. Open the blank tool (1.5)
    2. Open the first file in a specific folder (1.4)
    3. Check if Control!B3 says version 1.4.. if not, save the file to C:\Submissions\WrongVer\ and close it
    4. Copy a bunch of cells from 1.4 workbook to 1.5 workbook (i have this macro already recorded)
    5. Save 1.5 workbook with it's name based on Structure!J12 in C:\Submissions\Updated\
    6. Reopen the blank tool (1.5)
    7. Open the 2nd file ..
    And so on and so forth until all files in the folder are done.

    Sub x()
        Const sPath     As String = "C:\Submissions\"
        Dim sFile       As String
     
        sFile = Dir(sPath & "*.xlsm")
     
        Do While Len(sFile)
            With Workbooks.Open(sPath & sFile)
                On Error Resume Next
                Call Copy_Data
                ActiveWorkbook.Save 
                ActiveWorkbook.Close
            End With
            sFile = Dir()
        Loop
    End Sub
    Missing from the code above, because I don't know how to do it:
    - Open the 1.5 workbook as well
    - Check 1.4 for correct version
    - Save the populated 1.5 file with cellvalue name

    My apologies for asking, I've been trying to make this work all day and clearly my knowledge is not enough to get it done by myself.

    I appreciate your time!

    Cheers

    Maike

  2. #2
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,957

    Re: Macro to copy information from one version to another

    Is it just the VB code that is changing? If so, you can save the modules as *.bas files and import them.
    One spreadsheet to rule them all. One spreadsheet to find them. One spreadsheet to bring them all and at corporate, bind them.

    A picture is worth a thousand words, but a sample spreadsheet is more likely to be worked on.

  3. #3
    Registered User
    Join Date
    01-26-2011
    Location
    Canada
    MS-Off Ver
    Office 365
    Posts
    49

    Re: Macro to copy information from one version to another

    Quote Originally Posted by dflak View Post
    Is it just the VB code that is changing? If so, you can save the modules as *.bas files and import them.
    No it's a tool with very complex calculations. There is a structure tab in both versions and I need to copy information that the store filled out from structure tab of the old version, to the structure tab of the new version. But the cell placement changed around, so I can't just copy it all. What needs to be copied and where is a macro i have already recorded and is being called in my code above.

  4. #4
    Forum Expert dflak's Avatar
    Join Date
    11-24-2015
    Location
    North Carolina
    MS-Off Ver
    365
    Posts
    7,957

    Re: Macro to copy information from one version to another

    It would probably help a lot if we got a sample of both the 1.4 and 1.5 versions of the workbook. If I understand correctly, you want to copy the data from the 1.4 version workbook into the 1.5 version of the workbook, but the data isn't all in the same place in both workbooks. We would need to know this "mapping" E.g. Sheet X 1.4, Range P2:Pn to Sheet Y 1.5, Range Q2:Qn etc.

    The way I would design this is to have a third workbook as the update workbook. You tell it path names to where the "template" (in this case 1.5) is located as well as where all the target workbooks are located. Also on this sheet, you provide a "map" such as described above. Then the code can read each target workbook and use it to populate a clone of the template. It can save it back under the original target name or a version or date-stamped version of the name.

    However, we'll need a couple workbook samples first.

+ 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. Current version macro will work or not in future version
    By Sekars in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-02-2016, 09:59 AM
  2. Formulas not working in higher version, 2010 Version to 2013 version
    By thilag in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 10-19-2015, 09:09 PM
  3. Combine information from several rows into one - Excel Macro Version Needed
    By YSJ76 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-27-2013, 07:43 PM
  4. [SOLVED] Macro to determine version of excel version
    By dare2join in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-17-2013, 01:21 AM
  5. Macro to Copy Information for Each Worksheet
    By smmeader in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-19-2012, 12:40 PM
  6. Help with Copy/Paste Macro for 2010 version
    By ohedblad in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-18-2012, 10:09 AM
  7. Looking for Macro to copy information within a cell
    By thespeth in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 02-08-2012, 05:50 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