• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VBA to copy data from 5 different workbooks

xlsvba87

New Member
Hi

I have a quite confusing requirement. I have a consolidation file with one tab named "April". Similarly I have 5 different files, each having sheet "April" in it. I need to open each file, select that sheet and copy particular range(say C7:K54) and came back to the consolidation(macro) file "April" sheet and I have given provision to paste the data(say F7:N54) and repeat the same till last file.

But the challenge here is Copy range differs from file to file and same applies to paste range. For e.g. If we open the File1 and copies range C7:K54 and paste it in Consol File range F7:N54, but for File2 it needs to copy F7:N54 and paste in consol file AJ7:AR54 and so on. So basically what I need is to handle the difference.

Copy Range Paste Range
File 1 C7:K54 Consol File F7:N54
File 2 C7:N54 Consol File O7:Z54
File 3 C7:T54 Consol File AD7:AU54
File 4 C7:K54 Consol File BB7:BJ54
File 5 F7:N54 Consol File BN7:BV54

Thanks
 
Since you only have 5, I would probably hardcode it all. If you don't know much VB, could start by recording a macro of you opening each file, copying and pasting each section.
 
Back
Top