Update child sheet from master sheet by ID's

GirishDhruva

Active Member
Joined
Mar 26, 2019
Messages
308
Hi everyone,
Please Help me out with the solution

I have 13 sheets in one of my workbook, from which if i add any data in 1st sheet(Master worksheet),
based on months it should copy to that sheets(were my other sheets would be named as Jan,feb,mar....)
and if i need to update anything from any columns in my child sheets(that is Jan,feb,mar.... sheets),
then i should update only in master sheet and run the code so that it will be updated in my particular child sheets


I have tried with copying from master sheet to child sheets but i have no idea how to update the child sheets from my master sheet based on my ID's(were my ID's will be unique)

Like example:
If Jan sheet already has a row with ID number "1" then again if i run the code with some changes for the same ID then it should update that same row with new data from my master sheet

Code:
Sub Master_to_child()
Dim lastrow As Long, erow As Long, i As Long
Dim mydate As Date


lastrow = Worksheets("Consolidated").Cells(Rows.Count, 1).End(xlUp).Row
For i = 2 To lastrow
    mydate = Cells(i, 2)
        If mydate >= "1-Apr-19" And mydate <= "30-Apr-19" Then
            erow = Sheet2.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
            Range(Cells(i, 1), Cells(i, 2)).EntireRow.Copy Destination:=Sheets("Apr'19").Cells(erow, 1)
        ElseIf mydate >= "1-May-19" And mydate <= "31-May-19" Then
            erow = Sheet3.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
            Range(Cells(i, 1), Cells(i, 2)).EntireRow.Copy Destination:=Sheets("May'19").Cells(erow, 1)
        ElseIf mydate >= "1-Jun-19" And mydate <= "30-Jun-19" Then
            erow = Sheet4.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
            Range(Cells(i, 1), Cells(i, 2)).EntireRow.Copy Destination:=Sheets("Jun'19").Cells(erow, 1)
        End If
Next i
End Sub


Can anyone help me out for the solution
 
Last edited:

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.

Forum statistics

Threads
1,223,894
Messages
6,175,254
Members
452,623
Latest member
Techenthusiast

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