ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Copy Data from Workbook into specific Worksheet in other Workbook? (https://www.excelbanter.com/excel-discussion-misc-queries/77745-copy-data-workbook-into-specific-worksheet-other-workbook.html)

kingdt

Copy Data from Workbook into specific Worksheet in other Workbook?
 

Hope someone can help :confused:

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

Hope this makes sence and someone can help.

Thanks


--
kingdt
------------------------------------------------------------------------
kingdt's Profile: http://www.excelforum.com/member.php...o&userid=32531
View this thread: http://www.excelforum.com/showthread...hreadid=523143


Tom Ogilvy

Copy Data from Workbook into specific Worksheet in other Workbook?
 
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.


--
Regards,
Tom Ogilvy

"kingdt" wrote:


Hope someone can help :confused:

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

Hope this makes sence and someone can help.

Thanks


--
kingdt
------------------------------------------------------------------------
kingdt's Profile: http://www.excelforum.com/member.php...o&userid=32531
View this thread: http://www.excelforum.com/showthread...hreadid=523143




All times are GMT +1. The time now is 06:55 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com