-1

I have been trying to adapt similar solutions from here to my problem at hand but cannot get them to work as I am quite new to vba.

This is my situation:

  • There are a number of workbooks in a specific drive location.
  • I have the template for a summary file.
  • I would like to copy specific cells and ranges from different sheets in the workbooks into specific locations of the template.

Alternatively it could also work to

  • copy all sheets containing fields I want into the template
  • copy the cells and ranges there
  • delete the copied workbooks

However the second solutions seems a little inefficient to me.

Any help would be much appreciated.

Thank you already, Pat

PatB
  • 1
  • 1
  • [Okay](http://stackoverflow.com/help/how-to-ask). What have you tried? Your situation has been asked, in various formats, many times here and online generally. I'd start with learning how to create dynamic ranges, and working with multiple workbooks/worksheets. Let us know what code you've attempted, what has/hasn't worked, etc. – BruceWayne Oct 11 '16 at 14:20
  • 1
    are you sure you need vba? – David Andrei Ned Oct 11 '16 at 14:27
  • Thanks for the quick responses. I will try out your hints and see what I can come up with this evening. – PatB Oct 11 '16 at 15:00
  • I can now select a specific folder, which contains the files to import. But here the code stops at `ActiveSheet.Copy After:=Workbooks("MyFile.xlsm").Sheets(“sheet1”)` with runtime error '9': Index out of range. Do you have any idea as to why? – PatB Oct 12 '16 at 07:52

1 Answers1

0

How about all of these links ?

Without a specific question it's very hard to know what you are struggling with, but if you tried Googling your own question you will find that there are already tons of pages directed towards your general inquiry.

Community
  • 1
  • 1
David Andrei Ned
  • 799
  • 1
  • 11
  • 28
  • I have tried to modify the code in your [link](http://stackoverflow.com/questions/29008433/copy-the-value-from-a-cell-in-a-worksheet-into-a-range-of-cells?rq=1). When I try to compile it however the line – PatB Oct 12 '16 at 07:04
  • Set openWb = Workbooks.Open results in the error while compiling "Argument not optional". Which argument am I missing? – PatB Oct 12 '16 at 07:06