Workbook to workbook data transfers

  • Right now I am trying to figure out how to transfer data from one workbook to another, the problem I am dealing with is, getting the data to go the next available row, later I also plan on inserting some code to help with duplicates. However for now I am just trying to get the code from one excel workbook to open another workbook copy the data in A1 and B1 then transfer it to another workbook called "WB2WBtest2.xlsm" in the next available row. Here is what I have so far any tips and or suggestions would be greatly appreciated.


  • Re: Workbook to workbook data transfers


    pike that gets a compile error "expected =", however I was able to figure out how to make a piece of code work that could transfer data from one open workbook to a closed workbook, the problem I am facing now is inserting values with each data entry. I am trying to get this piece of code to copy the data to a workbook then add a value to the next column called "film" and then date and time. This is what I have:



    Any suggestions would be most appreciated.

  • Re: Workbook to workbook data transfers


    ok
    basically

    Code
    Dim copy_from As Range 
        Dim copy_to As Range 
         
        Set copy_from = Workbooks(1).Worksheets(1).UsedRange 
        Set copy_to = Workbooks(2).Worksheets(1).Range("A" & Rows.Count).End(xlUp).Offset(1, 0) 
         
        copy_from.Copy Destination:=copy_to


    or ..

    Code
    Lr = Workbooks("WB2WBtest2.xlsm").Worksheets("Sheet1").Cells(Rows.Count, "A").End(xlUp).Row+1
    
    
    Workbooks("WB2WBtest.xlsm").Worksheets("Sheet1").Range("A1:B1").Copy _
    Workbooks("WB2WBtest2.xlsm").Worksheets("Sheet1").("A" & Lr)

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!