do you want data to be pasted in same column ? Can you share a sample input files and output yo like to see?
On Sun, Jun 1, 2014 at 9:25 AM, Michael Lovin <mwlo...@gmail.com> 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. > -- *Regards* *Ashish Koul* *Visit* http://www.excelvbamacros.in Like Us on Facebook <https://www.facebook.com/excelvbacodes> Join Us on Facebook <http://www.facebook.com/groups/163491717053198/> P Before printing, think about the environment. -- 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.