How to fill multiple Excel sheets from master sheet

How to fill multiple Excel sheets from master sheet

This article will explain how you populate multiple excel sheets based on data entered in another main sheet by giving you and example and then the solution. You should then be able to adapt the solution to your own problems.

Example

I'm making an accounting workbook with the following criteria:

In the first sheet called "Account", all the transactions will be listed on table that goes from C6-H6, and on down for every entry. One of the columns in the table is labeled "Sector" and refers to expenses or revenues sources. There are 7 sectors and they each have a sheet in this workbook.

What I would like to do, is have each individual sector's sheet automatically populate with data each time the Account" sheet is updated, and have it based on the Sector column in the table. So basically, if the sector says "General", I would like for the entire row to be transferred to the sheet called "General". And so on for each individual sector.

Solution

Note 1: The Sector is entered in column H.

Note 2: Enter the sector as the last value of the row.

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Columns("H:H")) Is Nothing Then Exit Sub
Range(Range("C" & Target.Row), Range("H" & Target.Row)).Copy _
Sheets(Target.Value).Range("C" & Rows.Count).End(xlUp).Offset(1, 0)
End Sub

To implement the code:

  • Right-click on the "Account" tab and select View code.
  • Paste the code in the big white field.
Any more excel questions? Check out our forum!

Excel