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
Can anyone help me out for the solution
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: