Moving data from one sheet to another when condition is met

LuckyMonkey

New Member
Joined
Oct 24, 2018
Messages
4
Hi, I am looking for help moving data from a "master" sheet to several other "child" sheets based on data/response provided in a single column of the "master" sheet. Each "child" sheet is named after the possible data/responses in the "master" sheet. Below is a summary:
  • My "Master Worksheet" (TO DO) contains an active list of all actionable items for each client (identified in Column A) I work with and details of those actions (Columns B-J).
  • Each of the "Child Worksheets" is named to = client names
  • Column headers are all the same, expect TO DO sheet has an extra column (A) = client name
  • Within the "TO DO" worksheet, I capture the Client name, then enter all the details of the issue/actionable item in columns B-J.
  • I want the entire row of data (except Column A) to be copied to the corresponding Client Worksheet.
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
This macro assumes the client names start in row 2 of the "Master" sheet and you want the data to be pasted starting in column A of each client sheet.

Code:
Sub CopyRange()
    Application.ScreenUpdating = False
    Dim LastRow As Long, rName As Range
    LastRow = Sheets("Master").Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    For Each rName In Sheets("Master").Range("A2:A" & LastRow)
        Sheets("Master").Range("B" & rName.Row & ":J" & rName.Row).Copy Sheets(rng.Value).Cells(Sheets(rng.Value).Rows.Count, "A").End(xlUp).Offset(1, 0)
    Next rName
    Application.ScreenUpdating = True
End Sub
 
Last edited:
Upvote 0
Make the"Master" sheet the active sheet. While holding down the ALT key, press the F11 key. This will open the Visual Basic Editor. In the menu at the top, click the 'Insert' tab and then click 'Module'. Copy/paste the macro into the empty code window that opens up. Press the F5 key to run the macro. Close the window or return to your worksheet. There are easier ways to run a macro such as assigning it to a short cut key or to a button that you can insert into your worksheet.
 
Upvote 0
Thank you so much for the patience guidance.

I'm getting a run-time error (424): Object required. When I click "debug" the following line is highlighted. What am I missing?

Sheets("Master").Range("B" & rName.Row & ":J" & rName.Row).Copy Sheets(Rng.Value).Cells(Sheets(Rng.Value).Rows.Count, "A").End(xlUp).Offset(1, 0)
 
Upvote 0
Try:
Code:
Sub CopyRange()
    Application.ScreenUpdating = False
    Dim LastRow As Long, rName As Range
    LastRow = Sheets("Master").Cells.Find("*", SearchOrder:=xlByRows, SearchDirection:=xlPrevious).Row
    For Each rName In Sheets("Master").Range("A2:A" & LastRow)
        Sheets("Master").Range("B" & rName.Row & ":J" & rName.Row).Copy Sheets(rName.Value).Cells(Sheets(rName.Value).Rows.Count, "A").End(xlUp).Offset(1, 0)
    Next rName
    Application.ScreenUpdating = True
End Sub
 
Upvote 0
I got a new run-time error (9): Subscript out of range. When I click "debug" the following line is highlighted (again).

Sheets("MASTER").Range("B" & rName.Row & ":J" & rName.Row).Copy Sheets(rName.Value).Cells(Sheets(rName.Value).Rows.Count, "A").End(xlUp).Offset(1, 0)
 
Upvote 0
Do you have a sheet named "Master"?
 
Upvote 0

Forum statistics

Threads
1,214,920
Messages
6,122,269
Members
449,075
Latest member
staticfluids

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