Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.
Sub AppendData() Dim wbkMaster As Workbook Dim shtMaster As Worksheet Dim rngMaster As Range Dim wbkData As Workbook Dim shtData As Worksheet Dim rngData As Range ' change path and file name to suit Set wbkMaster = Workbooks.Open("D:\temp\testmaster.xls") Set shtMaster = wbkMaster.Worksheets(1) ' change path and file name to suit Set wbkData = Workbooks.Open("D:\temp\test1.xls") Set shtData = wbkData.Worksheets(1) ' get end of master Set rngMaster = shtMaster.Range("A65536").End(xlUp) ' Change as per your need Set rngData = shtData.Range("A11:A" & shtData.Range("A11").End(xlDown).Row) ' copy data across rngData.Copy rngMaster MsgBox "Appended " & rngData.Rows.Count & " rows of data to Master data", vbInformation ' simply close data wbkData.Close False ' save and close master wbkMaster.Close True ' release objects Set rngData = Nothing Set shtData = Nothing Set wbkData = Nothing Set rngMaster = Nothing Set shtMaster = Nothing Set wbkMaster = Nothing End Sub
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.