copy paste macro VBA

  • I need to create a macro as below but the record doesn't seem to work. since I'm new to VBA I'm unable to debug the issue as well.

    the idea is as below.

    1. give the path by browsing the set of files in a folder.

    2. copy sheet 1 with row range - row 10 to last row from multiple files, and paste one below the other in a master file..

    3. copy sheet 2 with range row 22 to last row by referring to column g and paste one below other in the same master file as above.

    your help will be of great favour... thanks in advance.


    • test file.xlsx

      (12.06 kB, downloaded 104 times, last: )
  • I created a file but it works only for sheet 2 ... while I need to add additional function to the code for copying sheet 1 with row range - row 10 to last row from multiple files, and paste one below the other in a master file.. Im hereby attaching the vba code in text file.


    • vba.txt

      (2.32 kB, downloaded 114 times, last: )
  • the current program works very much fine. as per the program what I need to add is to copy paste the row 10 till the last valid column & row from sourceBook sheet 1 and paste it in masterBook sheet 1 row 10 one below the other. I hope now its clear..

  • hi roy,

    i made changes as below in the code. but it fails to render my output. any idea?

  • I don't understand what you are doing. As I said, your workbook contains two sheets, but the sheets are not laid out the same.

    Your code will always paste to row 11

    Also, why use unmerg when I cannot see any MergedCells and what range is the code copying?

  • Hi Roy , Ill make it little clear and simpler... please ignore all confusions above and check the below.

    1. I need to browse and set path for files that I have in a folder.

    2. Copy row 10 from all the files in that folder and paste it in the master sheet that that has the macro.

    Please refer the attachment below. Kindly note that I am not trying using this forum as service provider. I have given the area I am failing to achieve In a statement manner.

  • brother please don't refer any code in there. that is a separate operation... Please advise on my requirement. Ill use my knowledge to consolidate them ... ( Since explaining everything is creating too much of confusion!! )

  • Your existing code in the workbook doesn't look like it will work. It does loop through a folder, but the copying looks wrong.

    Do you want similar code to copy just Row 10? Row 10 in all the examples that I have looked at though is not a full row of data.

  • HI Roy.. I have got a solution!! thanks for your work ... if you could please delete the below conversations ill proceed to post the code here as answer...