PDA

View Full Version : Extracting Data From Specific Cells From Each File Form A Netwrok Folder



tahas
01-05-2016, 01:54 PM
Hi Friends,
I just joined the group and would appreciate your help in brushing my code which gives me "Run-time error '13' Type Mismatch. The error appears in
(myFile = Dir(myPath & myExtension). Attached please find my code (thanks to thespreadsheetguru.com/):

Regards,
Taha

alansidman
01-05-2016, 10:17 PM
nothing attached

tahas
01-06-2016, 09:25 AM
My apologies!

Please note that I was able to extract data from a SINGLE FILE from a FOLDER but I need to EXTRACT data from MULTIPLE FILES.

Any help would be greatly appreciated.

Attached is my file code file.

Thanks in advance,
Taha

SamT
01-06-2016, 11:04 AM
myFile = Dir(myPath & myExtension) ' Retrieve the first file name.
Do While myFile <> "" ' Start the loop.
'
'your code here
'
myFile = Dir ' Get next file name.
Loop

tahas
01-06-2016, 11:48 AM
Thanks a lot SamT but unfortunately, I could not understand where exactly I need to put your code in. Can you please advise? or if not much of a hassle can you please modify the the code in the attached file?

Regards,
T

SamT
01-06-2016, 01:06 PM
Note to all: Code in OP's attached is direct copy of http://www.vbaexpress.com/kb/getarticle.php?kb_id=454

@ Tahas,

So far, all that I can surmise from this thread is that you want to get the data from many workbooks.Sheets("Sheet1").Range("A1:K10"). Period. Stop. End of Surmising.

We need many more details.

tahas
01-06-2016, 02:08 PM
Thanks for your quick response SamT.

Here is my scenario:
· I have a folder with over 500 Excel files (.xlsx)
· I need to create a summary report that captures information from Cells M377:W385 (total 9 rows and 11 columns) from each file
· I need to get data from File001 to Cells A1:K9 of Summary File; next
· I need to capture the data of File002 to Cells A10:K18 and so on until I get data from all files from the folder without opening any of my 500+ files.

Hope this clarifies.

Thanks,
T