martinus1988

New Member
Joined
Aug 13, 2015
Messages
15
Hi all,

This is a lot to ask but i am really stuck at this point.
I almost completed my file but I am looking for a solution.
I have a partlist for every product (named as Aricle 1,2,3,etc). This file contains 1 sheet with like 20 rows of data. I am looking for a way to copy the data from those files to a sheet in this file.

So: C:\\Test\Partlist\Article1.xlsx must copy to this file, sheet: article 1.


Path of articleCopy to sheet
C:\\Test\Partlist\Article1.xlsxArticle 1
C:\\Test\Partlist\Article2.xlsxArticle 2
C:\\Test\Partlist\Article3.xlsxArticle 3
C:\\Test\Partlist\Article4.xlsxArticle 4
C:\\Test\Partlist\Article5.xlsxArticle 5
C:\\Test\Partlist\Article6.xlsxArticle 6
C:\\Test\Partlist\Article7.xlsxArticle 7
C:\\Test\Partlist\Article8.xlsxArticle 8
Rules VBA
Colom A is the path of the file
Colom B is the sheet (in this file) were it has to copy to.
When button is pushed the article sheets must renew (do delete and rebuild)
(Good to know that every file in path has only 1 sheetname is standard)
All the files are xlsx.



<colgroup><col><col></colgroup><tbody>
</tbody>
Can someone help me please.
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Hi, martinus
The sheets in the list col B, they are already exist, right?
Try this code:

Code:
Sub a924855a()
Dim ws As Worksheet
Dim wb1 As Workbook

Application.ScreenUpdating = False
Set wb1 = ActiveWorkbook

For Each r In Range("A2", Cells(Rows.count, "A").End(xlUp))
  Workbooks.Open r.Value
  sheets(1).Cells.Copy wb1.sheets(r.Offset(0, 1).Value).Cells
  Application.CutCopyMode = False
  Debug.Print ActiveWorkbook.Name
  ActiveWorkbook.Close False
Next

Application.ScreenUpdating = True
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,461
Messages
6,124,956
Members
449,200
Latest member
indiansth

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top