How To Auto Transfer Data from Master to Sub Sheets in Excel
On April 10,2022 by Tom RoutleyIf you are using Excel and would like to automatically transfer data from a master sheet to specified sub sheets when a certain condition is met, this article will explain how to use VBA (Visual Basic for Applications) to do so. This example will demonstrate how to automatically transfer multiple columns in one sheet to another when the value in one of the fields is "Yes". The value of the conditional field can be changed as required.
Autotransfer Data from Master to Sub Sheets in Excel
To get started, open your Excel document and open the Microsoft Visual Basic for Applications window by hitting [Alt] + [F11].
Next, find your sheets in the left column and double-click on the Master. The sheet names will depend on what you have named them in Excel. The Master sheet is the primary sheet where the data is first entered, and the Sub sheet is the location where the data will be populated. Next, paste the following code in the large white field:
Private Sub Worksheet_Change(ByVal Target As Range) If Intersect(Target, Columns("G")) Is Nothing Then Exit Sub 'When there is no change in 'column G then do nothing. 'The cell value that was changed in column G will now be referred to as Target. If Target.Value = "Yes" Then 'When condition is met ("Yes" in column G) then Range(Cells(Target.Row, "A"), Cells(Target.Row, "G")).Copy _ Sheets(Target.Offset(0, -1).Value).Range("A" & Rows.Count).End(xlUp).Offset(1, 0) 'Copy the row where the change is made from column A till column G. 'Paste to the sheet mentioned in column F and to the first available row. End If End Sub
Now, you can close the Microsoft Visual Basic for Applications window and your file will now be ready to automatically transfer data entered on the master sheet to the selected sub sheets. Remember that the Macro will only run when a change is made in column G.
Image: © 123RFom
Article Recommendations
Latest articles
Popular Articles
Archives
- November 2024
- October 2024
- September 2024
- August 2024
- July 2024
- June 2024
- May 2024
- April 2024
- March 2024
- February 2024
- January 2024
- December 2023
- November 2023
- October 2023
- September 2023
- August 2023
- July 2023
- June 2023
- May 2023
- April 2023
- March 2023
- February 2023
- January 2023
- December 2022
- November 2022
- October 2022
- September 2022
- August 2022
- July 2022
- June 2022
- May 2022
- April 2022
- March 2022
- February 2022
- January 2022
- December 2021
- November 2021
- October 2021
- September 2021
- August 2021
- July 2021
- January 2021
Leave a Reply