vendredi 27 mars 2015

How to copy data from closed workbooks(keeping them closed) into master workbook using VBA

i need help to copy data from few closed workbooks, without opening them, into a master workbook using VBA. today i use the function Workbooks.open in order to do so, though i use 4-6 files to copy data from, and each file that needs to open - slows down dramatically the copy operation.


i need help in using efficient VBA code for copying data without opening each file.


here is an example of my code: Set x = Workbooks.Open("C:\Bel.xls") 'Now, copoy what you want from x: x.Sheets("Daily Figures").Range("A13:j102").Copy 'Now, paste to y worksheet y.Activate Sheets("Data - Daily").Range("N2").PasteSpecial 'Close x: Application.CutCopyMode = False x.Close Sheets("sheet1").Range("M4") = Date


please help thanks in advance,


Aucun commentaire:

Enregistrer un commentaire