Hi there
I am currently in the process of trying to set up a master table based upon two tables I already have and to formulate a code that will allow any new data added to the two tables to copy into the master table. All tables are in the same workbook and are set out as follows:
I have found the following code that works when the data is in its worksheet form (not as tables).
The only issue with this code is that it copies across the headers from the "Outgoing" and "Incoming" sheets which I would like it to exclude as they are the same headers as already stated on the "master tracker".
Is there a code similar to this that could be used for tables (the ideal situation!)? Otherwise how do I go about excluding copy of the headers on both the "Outgoing" and "Incoming" worksheets in this code.
Another aspect that would be super helpful would be if the code could auto-run (another ideal situation).
Any help would be much appreciated. I know zero to nothing about VBA so have only got this far thanks to forum's as such and playing with codes people have added.
Please note I am using excel 2007.
Thanks,
Sarah
I am currently in the process of trying to set up a master table based upon two tables I already have and to formulate a code that will allow any new data added to the two tables to copy into the master table. All tables are in the same workbook and are set out as follows:
- Sheet one = "Master Tracker"
- Sheet two = "Outgoing"
- Sheet three = "Incoming"
I have found the following code that works when the data is in its worksheet form (not as tables).
Sub Summarize()
Dim ws As Worksheet
Dim lastRng As Range
Application.ScreenUpdating = False ' speed up code
ThisWorkbook.Sheets("Master Tracker").Range("A2:M65536").ClearContents 'clear
For Each ws In ThisWorkbook.Worksheets
Set lastRng = ThisWorkbook.Sheets("Master Tracker").Range("a65536").End(xlUp).Offset(1, 0)
Select Case ws.Name
Case "Master Tracker" 'exlude
'do nothing
Case "Folha1"
Case Else
ws.Activate
'copy data from individual sheets
Range("A250", Range("X65536").End(xlUp)).Copy lastRng
End Select
Next
Application.CutCopyMode = False 'clear clipboard
Application.ScreenUpdating = True
Sheets("Master Tracker").Activate
Cells.Select
End Sub
The only issue with this code is that it copies across the headers from the "Outgoing" and "Incoming" sheets which I would like it to exclude as they are the same headers as already stated on the "master tracker".
Is there a code similar to this that could be used for tables (the ideal situation!)? Otherwise how do I go about excluding copy of the headers on both the "Outgoing" and "Incoming" worksheets in this code.
Another aspect that would be super helpful would be if the code could auto-run (another ideal situation).
Any help would be much appreciated. I know zero to nothing about VBA so have only got this far thanks to forum's as such and playing with codes people have added.
Please note I am using excel 2007.
Thanks,
Sarah