Hello<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o></o>
<o></o>
As somebody with no coding experience, I have a question re the coding below if that is ok;<o></o>
<o></o>
Next month, I am being sent 200 project workbooks, each consisting of 4 worksheets where the data in the first worksheet in each workbook is standardised (as is all worksheets 2s, 3s and 4s in each workbook) but there is no standardisation between worksheet 1, 2, 3 and 4 within each workbook. The workbooks being sent to me for Quarter 1 reporting and will be put in a folder labelled 2011Q1R. <o></o>
I need to consolidate the workbooks by;<o></o>
<o></o>
1) Creating a consolidated standardised master workbook which consists of one worksheet with an embedded macro (button) which pulls all the data from each worksheet within each project workbook (not the workbook itself) and arranges it into a one-row entry so that I am left with a standardised workbook with single row entries for each of the project workbooks in the Q1 folder<o></o>
2) I will receive approx 200 workbooks every three months, placed in 2011 Q2R etc which will need to be added to the master workbook which I assume can be done using the macros in 1 with a little tweaking i.e. source<o></o>
<o></o>
Efforts so far have amounted to having a consolidation worksheet with two macro buttons, the first of which draws in all the worksheets from the workbooks (not the data) in the folder to the consolidation workbook while the second macro button uses 4 versions of the inital coding below (1 for each worksheet) along with recorded a macro that ensures all data from one workbook is on one row (the initial coding below puts each worksheet data on subsequent rows), run by way of an overarching subroutine. As I am sure you can tell, apart from dragging the workbooks and not the data, the macros also only consolidate 1 workbook. Would there be some way of tweaking the coding below so that I can achieve (1) above or would it need a completely new macro?<o></o>
<o></o>
I hope this makes sense but any questions, please ask. I have als postd this on http://www.pcreview.co.uk/forums/co...s-1-wsheet-1-wbook-t4037086.html#post14093003<o></o>
<o></o>
Thanks in advance for any help you may be able to provide<o></o>
Thanks<o></o>
Andrew<o></o>
<o></o>
<o></o>
As somebody with no coding experience, I have a question re the coding below if that is ok;<o></o>
<o></o>
Next month, I am being sent 200 project workbooks, each consisting of 4 worksheets where the data in the first worksheet in each workbook is standardised (as is all worksheets 2s, 3s and 4s in each workbook) but there is no standardisation between worksheet 1, 2, 3 and 4 within each workbook. The workbooks being sent to me for Quarter 1 reporting and will be put in a folder labelled 2011Q1R. <o></o>
I need to consolidate the workbooks by;<o></o>
<o></o>
1) Creating a consolidated standardised master workbook which consists of one worksheet with an embedded macro (button) which pulls all the data from each worksheet within each project workbook (not the workbook itself) and arranges it into a one-row entry so that I am left with a standardised workbook with single row entries for each of the project workbooks in the Q1 folder<o></o>
2) I will receive approx 200 workbooks every three months, placed in 2011 Q2R etc which will need to be added to the master workbook which I assume can be done using the macros in 1 with a little tweaking i.e. source<o></o>
<o></o>
Efforts so far have amounted to having a consolidation worksheet with two macro buttons, the first of which draws in all the worksheets from the workbooks (not the data) in the folder to the consolidation workbook while the second macro button uses 4 versions of the inital coding below (1 for each worksheet) along with recorded a macro that ensures all data from one workbook is on one row (the initial coding below puts each worksheet data on subsequent rows), run by way of an overarching subroutine. As I am sure you can tell, apart from dragging the workbooks and not the data, the macros also only consolidate 1 workbook. Would there be some way of tweaking the coding below so that I can achieve (1) above or would it need a completely new macro?<o></o>
<o></o>
I hope this makes sense but any questions, please ask. I have als postd this on http://www.pcreview.co.uk/forums/co...s-1-wsheet-1-wbook-t4037086.html#post14093003<o></o>
<o></o>
Thanks in advance for any help you may be able to provide<o></o>
Thanks<o></o>
Andrew<o></o>
<o></o>
Code:
Public Sub CopyCells2()<o:p></o:p>
Dim TargetRow As Long<o:p></o:p>
Dim TargetCol As Integer<o:p></o:p>
<o:p></o:p>
<o:p></o:p>
'CONFIG HERE<o:p></o:p>
Const TargetSheets As String = "consolidation"<o:p></o:p>
Const SourceCells As String = "C4,c6"<o:p></o:p>
Const SourceSheet As String = "delivery confidence"<o:p></o:p>
<o:p></o:p>
For Each TargSh In Split(TargetSheets, ",")<o:p></o:p>
With ThisWorkbook.Sheets(TargSh)<o:p></o:p>
TargetRow = .Cells(.Rows.Count, 1).End(xlUp).Row + 1<o:p></o:p>
TargetCol = 0<o:p></o:p>
For Each celladdr In Split(SourceCells, ",")<o:p></o:p>
TargetCol = TargetCol + 1<o:p></o:p>
.Cells(TargetRow, TargetCol).Value = _<o:p></o:p>
ThisWorkbook.Sheets(SourceSheet).Range(celladdr).Value<o:p></o:p>
Next celladdr<o:p></o:p>
End With<o:p></o:p>
Next TargSh<o:p></o:p>
End Sub<o:p></o:p>
<o:p></o:p>
Sub GetSheets()<o:p></o:p>
Path = "H:\Bod\GMPP\Pilot data\pilot\"<o:p></o:p>
Filename = Dir(Path & "*.xls")<o:p></o:p>
<o:p></o:p>
Do While Filename <> ""<o:p></o:p>
Workbooks.Open Filename:=Path & Filename, ReadOnly:=True<o:p></o:p>
For Each Sheet In ActiveWorkbook.Sheets<o:p></o:p>
Sheet.Copy After:=ThisWorkbook.Sheets(1)<o:p></o:p>
Next Sheet<o:p></o:p>
Workbooks(Filename).Close<o:p></o:p>
Filename = Dir()<o:p></o:p>
Loop<o:p></o:p>
End Sub<o:p></o:p>
<o:p></o:p>
Sub RunMacrosRun()<o:p></o:p>
<o:p></o:p>
With Application<o:p></o:p>
.ScreenUpdating = False<o:p></o:p>
.EnableEvents = False<o:p></o:p>
End With<o:p></o:p>
<o:p></o:p>
Dim strDate As String<o:p></o:p>
Dim cmt As Comment<o:p></o:p>
<o:p></o:p>
strDate = "dd-mmm-yy hh:mm:ss"<o:p></o:p>
Set cmt = ActiveCell.Comment<o:p></o:p>
<o:p></o:p>
If cmt Is Nothing Then<o:p></o:p>
Set cmt = ActiveCell.AddComment<o:p></o:p>
cmt.Text Text:="Data Merged on" & Chr(10) & Format(Now, strDate) & Chr(10)<o:p></o:p>
Else<o:p></o:p>
cmt.Text Text:=cmt.Text & Chr(10) & Format(Now, strDate) & Chr(10)<o:p></o:p>
End If<o:p></o:p>
<o:p></o:p>
With cmt.Shape.TextFrame<o:p></o:p>
.Characters.Font.Bold = False<o:p></o:p>
End With<o:p></o:p>
<o:p></o:p>
Application.Run "CopyCells"<o:p></o:p>
Application.Run "Copycells2"<o:p></o:p>
Application.Run "Copycells3"<o:p></o:p>
Application.Run "Copycells4"<o:p></o:p>
Application.Run "MacroAP2"<o:p></o:p>
Application.Run "EE4A"<o:p></o:p>
End Sub