I'm creating a database for a research study that has a "master sheet" with all the details for every study participant.

The participants are listed in rows, with their details in multiple columns.

The study participants all belong to 9 subgroups which are defined by two of the columns (e.g. X and Y), whose values can be between 1 and 3.

I would like to have a macro that runs through the master sheet and copies part of the row (e.g. columns A-M) for each participant into a separate work sheet based on their subgroup defined by columns X and Y.

For example:
- If on row 2 of the master sheet x2=1 and y2=1, then copy a2:m2 to the next empty line in worksheet 2 (starting from row 2)
- If on row 3 of the master sheet, x3=1 and y3=1, then compy a3:m3 to the next empty line in worksheet 3 (starting from row 3)

It is important to just copy part of the row, not the entire row, because there is information to the right of the main dataset in each worksheet that I do not want modified.

I have the following code which will copy the entire row into sheet 2 based on a single criteria in column x:

Sub copyrows()

Dim tfCol As Range, Cell As Object

Set tfCol = Range("x2:x1000")

For Each Cell In tfCol

If IsEmpty(Cell) Then
Exit Sub
End If

If Cell.Value = "1" Then
Cell.EntireRow.Copy
Sheet2.Select
ActiveSheet.Range("A65536").End(xlUp).Select
Selection.Offset(1, 0).Select
ActiveSheet.Paste
End If

Next

End Sub

This works well, but it copies the entire row, not just columns A-M, and it only uses one variable. Is it possible to modify this code to perform the task I need, or will I require a different approach.

My experience with visual basic is extremely limited so as detailed help as possible would be very much appreciated. I have tried extensive searches on forums but can't quite find code that suits my problem.

Many thanks in advance for any help.