Edit macro to include two extra worksheets data to be copied
Posted on 2013-01-21
I have the following macro that copies data in sequence from one workbook (worksheet) to another.
It currently copies data from or worksheet "cm" template file to master file worksheet "cm1"
I want it now to copy data from worksheet "orange" to "orange1" and worksheet "apple" to "apple1" in the master template...
All files are in the same c:\ path...same sequence as below:-
Dim wbDst As Workbook
Dim wbSrc As Workbook
Dim strFilename As String
Set wbDst = ThisWorkbook ' Workbooks.Open("C:\Documents and Settings\Test\Master Template.xls")
strFilename = Dir("C:\Documents and Settings\Test\*.xls")
While strFilename <> ""
If strFilename <> wbDst.Name Then
Set wbSrc = Workbooks.Open("C:\Documents and Settings\Test\" & strFilename)
wbSrc.Worksheets("cm").UsedRange.Copy wbDst.Worksheets("cm1").Range("A" & Rows.Count).End(xlUp).Offset(1)
strFilename = Dir()