It worked sort of...... here is the master_file1.xlsm BEFORE running the VB...
Score by Category Grammar Reading / Writing Vocabulary Speaking / Listening Here it is AFTER runing the last code you sent Score by Category student1 student2 student3 Student_Master Table1 Grammar 0% 0% 0% Reading / Writing 0% 0% 0% Vocabulary 0% 0% 0% Speaking / Listening 0% 0% 0% As you can see it added some data but just zeros and also that "Student_Master Table1" On Sunday, June 1, 2014 11:55:15 AM UTC+8, Michael Lovin wrote: > > I am sure this has been asked many times but I cannot find a thread that > answers my questions..... I have code (pasted below) but it does not work > and it does not error....(no highlight or pop up error message) > > I have several workbooks with sequential file names..student1, student2, > etc. .In each workbook first sheet (Sheet1) there is a coloum with data > (J6:J9) .. Each row is a different label ie Gammar, Vocabulary, etc > I want to sequence through the workbooks, copy the data at (J6:J9) and > paste it into master workbook, in a rows with the colum as the titles ...so > under A coloum the J6:J9 data is pasted into A1, A2,,A3, etc in sequence > for all the student workbooks. > I hope I explained that clearly... here is the code so far...but not > working and no error pop up.... > > Sub LoopThroughDirectory() > Dim MyFile As String > Dim erow > Dim Filepath As String > MyFile = > Dir("C:\Users\Michael\Desktop\ESL_Consulting\Students\Student_Test\)") > > Do While Len(MyFile) > 0 > If MyFile = "Student_Master.xlsm" Then > Exit Sub > End If > Workbooks.Open (Filepath & MyFile) > Range("J6:J9").Copy > ActiveWorkbook.Close > erow = Sheet1.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row > ActiveSheet.Paste Destination:=Worksheets("Sheet1").Range(Cells(erow, 1), > Cells(erow, 4)) > > MyFile = Dir > Loop > End Sub > > -- Are you =EXP(E:RT) or =NOT(EXP(E:RT)) in Excel? And do you wanna be? It’s =TIME(2,DO:IT,N:OW) ! Join official Facebook page of this forum @ https://www.facebook.com/discussexcel FORUM RULES 1) Use concise, accurate thread titles. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get quick attention or may not be answered. 2) Don't post a question in the thread of another member. 3) Don't post questions regarding breaking or bypassing any security measure. 4) Acknowledge the responses you receive, good or bad. 5) Jobs posting is not allowed. 6) Sharing copyrighted material and their links is not allowed. NOTE : Don't ever post confidential data in a workbook. Forum owners and members are not responsible for any loss. --- You received this message because you are subscribed to the Google Groups "MS EXCEL AND VBA MACROS" group. To unsubscribe from this group and stop receiving emails from it, send an email to excel-macros+unsubscr...@googlegroups.com. To post to this group, send email to excel-macros@googlegroups.com. Visit this group at http://groups.google.com/group/excel-macros. For more options, visit https://groups.google.com/d/optout.
master_file1.xlsm
Description: application/vnd.ms-excel.sheet.macroenabled.12