One question that I had was in the my case where I am going to now be copying the range K29:t53, how do I get it copy starting at cell A1 in the new sheet? Presently it copies it to cells K29:T53 in the new sheet.
Also, is there a way to copy the informatio to one single new sheet rather than 10-12 sheets?
Here's the code that I am using right now with the updated paths and range.
Sub Folder_WorkbooksCopy()
Dim wkbCopy As Excel.Workbook
Dim Path$, Workbook$, RangeCopy$
Dim Sheet%
Application.DisplayAlerts = False
Application.EnableEvents = False
'set range address to copy from/to
RangeCopy$ = "K29:T53"
Path$ = "W:\Comptrol\Corp_Rep\MONTHEND\2002\Monthly Stewardship\OPEX\"
Workbook$ = Dir(Path$ & "*01*.xls"
'loop all workbooks in folder
Do While Not Workbook$ = ""
'assign sheet index to copy data to
Sheet% = Sheet% + 1
'open workbook to copy from
Set wkbCopy = GetObject(Path$ & Workbook$)
'copy cell values
ThisWorkbook.Sheets(Sheet%).Range(RangeCopy$).Value = _
wkbCopy.Sheets(1).Range(RangeCopy$).Value
wkbCopy.Close
Set wkbCopy = Nothing
'try to find nexr workbook in folder
Workbook$ = Dir
Loop
Application.EnableEvents = True
Application.DisplayAlerts = True
End Sub
Thanks. Help Me Obi Wan Kenobi, You're My Only Hope.
Also, is there a way to copy the informatio to one single new sheet rather than 10-12 sheets?
Here's the code that I am using right now with the updated paths and range.
Sub Folder_WorkbooksCopy()
Dim wkbCopy As Excel.Workbook
Dim Path$, Workbook$, RangeCopy$
Dim Sheet%
Application.DisplayAlerts = False
Application.EnableEvents = False
'set range address to copy from/to
RangeCopy$ = "K29:T53"
Path$ = "W:\Comptrol\Corp_Rep\MONTHEND\2002\Monthly Stewardship\OPEX\"
Workbook$ = Dir(Path$ & "*01*.xls"
'loop all workbooks in folder
Do While Not Workbook$ = ""
'assign sheet index to copy data to
Sheet% = Sheet% + 1
'open workbook to copy from
Set wkbCopy = GetObject(Path$ & Workbook$)
'copy cell values
ThisWorkbook.Sheets(Sheet%).Range(RangeCopy$).Value = _
wkbCopy.Sheets(1).Range(RangeCopy$).Value
wkbCopy.Close
Set wkbCopy = Nothing
'try to find nexr workbook in folder
Workbook$ = Dir
Loop
Application.EnableEvents = True
Application.DisplayAlerts = True
End Sub
Thanks. Help Me Obi Wan Kenobi, You're My Only Hope.