View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
[email protected] Office@siouxlandhabitat.org is offline
external usenet poster
 
Posts: 6
Default Combine sheets into one

On Monday, April 3, 2017 at 8:26:21 AM UTC-5, GS wrote:
Paste this into a standard module:

Key Alt+F11 to open the VBE:
Right-click your file in the Project Explorer pane;
InsertModule.


Option Explicit

Sub ConsolidateSheets()
Dim lRow&, lRow2&, vData, vSh, wsTgt As Worksheet
Dim CalcMode As XlCalculation

'Get a ref to the target sheet
Set wsTgt = ThisWorkbook.Sheets("Consolidate")
wsTgt.Cells.ClearContents: lRow2 = 1

'EnableFastCode
With Application
.ScreenUpdating = False: .EnableEvents + False
CalcMode = .Calculation: .Calculation = xlCalculationManual
End With 'Application

'Transfer data from the other sheets to the next empty row
On Error GoTo Cleanup
For Each vSh In ThisWorkbook.Sheets
If Not vSh = wsTgt Then
lRow = vSh.Range("A" & vSh.Rows.Count).End(xlUp).Row + 1
vData = vSh.Range("A1:BB" & lRow)
wsTgt.Cells(lRow2, "A").Resize(UBound(vData), UBound(vData, 2)) = vData
lRow2 = lRow2 + UBound(vData) '//set next blank row
End If
Next 'vSh

Cleanup:
Set wsTgt = Nothing
'DisableFastCode
With Application
.ScreenUpdating = False: .EnableEvents + False: .Calculation = CalcMode
End With 'Application
End Sub 'ConsolodateSheets

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion


Hi Garry
Thanks for the quick response. Unfortunately, you are probably going to tell me I have no business try to do this.......
I don't know what you mean by
'Standard Module' or 'Project Explorer pane'.
Paste this into a standard module:

Key Alt+F11 to open the VBE:
Right-click your file in the Project Explorer pane;
InsertModule.

I have a folder in my google drive with three forms which are feeding into one workbook. In the workbook, I have three tabs/sheets of data feeding in from the forms and I have made an additional tab/sheet called Aggregate where I would like the data from the three sheets/forms to feed into from the individual sheets. I will continue to add more forms, hence more tabs/sheets of data will be added to the workbook on a continual basis.

Does this make sense and are you able to clarify Module and Project Explorer pane?

I so much appreciate your input.