Copy Data from Workbook into specific Worksheet in other Workbook?

K

kingdt

Hope someone can help :confused:

What I want to do is have a macro that copies the same cells from 1
different specifically named excel files and pastes them onto th
relevant worksheet within another workbook. All the files will b
within 1 folder.

Hope this makes sence and someone can help.

Thank
 
G

Guest

here is some pseudo code
Dim sname as String
Dim bk as Workbook
Dim rng as Range
sname = dir("C:\Myfolder\Myfile*.xls")
do while sName <> ""
set bk = workbooks.open("C:\MyFolder\" & sName)
set rng = bk.worksheets(1).Range("A1:A10")
rng.copy thisworkbook.worksheets( _
left(sName,len(sname)-4)).Range("A1")
bk.close Savechanges:=False
sName = dir()
Loop

Obviously I don't know how "particular" or "relevant" should be specifically
implemented in the code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top