Need Help! Moving Data from sheets to a master sheet

coyotefest

New Member
Joined
Nov 5, 2014
Messages
5
Hello All.

I am new to the form and will appreciate any help. A quick overview I have never coded in excel (macros, VBA) but have used MatLab and C so i do have a descent understanding of code.
The easiest way to explain it will be to add the table I'm working with

the first table is the master sheet

Machine #Serial #ModelDate installedFailure datedescriptionwork order
1123a5/15/14
2456b5/15/14
3789c5/15/14

<tbody>
</tbody>

the next table is and example of one of the machines (each is a separate sheet but follows this format)
Machine #Serial #ModelDate installedFailure datedescriptionwork order
1123a5/15/148/19/14hjddjhfhfsh

<tbody>
</tbody>

this table is what I would like to achive


Machine #Serial #ModelDate installedFailure datedescriptionwork order
1123a5/15/148/19/14hjddjhfhfsh
1123a5/15/149/15/14hdhshjsk
2345b5/15/14
3678c5/15/14

<tbody>
</tbody>



The idea is that the user will type the information (failure date, description, work order) in the sheet assigned to a machine. the data will then be copied over to the new sheet. the machine # serial # model and date installed will not change but should still copy over as scene in the above example. Ideally if the user inputs data into machine 2 i should push the rows below machine 2 down. There are in total 8 machines but if 2 sheets(machines) working I can make the rest work.

I apologize for the lengthiness of the description but i think i have describe every thing.

again I have no background in VBA or macros but do understand code this is just out of my comfort zone.

Thank you all.
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
I just want to confirm that I understand before I work on this. You have 8 machines. Each machine is on a seperate sheet. You want to copy every row in each machine sheet and paste it to the master sheet. Sound about right?

If so then I'm going to write code that says, For Each worksheet, if it is not the master sheet, copy the range starting in A2 through G last row in table, and paste it to the master sheet.
 
Upvote 0
First thank you for the quick response.

Yes except that on each machine sheet a2:d2 will only have that line of data. That is collumn a:d will not have any new data but a2:d2 needs to show up each time on the master sheet if data is entred into e:g
 
Upvote 0
So on the machine sheets, every row has the same data in columns A through D right? Because if not, then this has gotten harder than just copy paste.
 
Upvote 0
I'm confused. Here is the code I wrote. Let me know if it's what you wanted.
Code:
Sub myMacro()
    master = "Master"  [COLOR=#008000]'The master sheet[/COLOR] 
    
[COLOR=#008000]    '### Erase all data from master sheet except headers###[/COLOR]
    lastRow = Sheets(master).Range("A" & Rows.Count).End(xlUp).Row
    If lastRow > 1 Then
        Sheets(master).Range("A2:G" & lastRow).ClearContents
    End If
[COLOR=#008000]    '######################################################
    
    '### Copy Paste code ###[/COLOR]
    masterNextRow = 2
    For Each WS In ActiveWorkbook.Worksheets
        If WS.Name <> master Then
            lastRow = Sheets(WS.Name).Range("A" & Rows.Count).End(xlUp).Row
            If lastRow > 1 Then
                Sheets(WS.Name).Range("A2:G" & lastRow).Copy
                ActiveSheet.Paste Destination:=Sheets(master).Range("A" & masterNextRow)
                Application.CutCopyMode = False
                masterNextRow = Sheets(master).Range("A" & Rows.Count).End(xlUp).Row + 1
            End If
        End If
    Next WS
  [COLOR=#008000]  '#######################[/COLOR]
End Sub
 
Upvote 0
YES!! Thank you This is exactly what Im looking for. :)
The only thing is, and this cold be my lack of understand of how macros work. But it seems that if I add data to one of the machine sheets that the only way to up date the master is to delete all the data in the master then run the code again. This works but can do i have to delete the data from the master every time i update.
 
Upvote 0
No you do not need to manually delete the data before you run the macro. The code I gave you already deletes the data in the master sheet before it begins the copy pasting. You see where I labeled it
'### Erase all data from master sheet except headers###</pre>
 
Upvote 0

Forum statistics

Threads
1,215,482
Messages
6,125,058
Members
449,206
Latest member
Healthydogs

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top