Copy data from one worksheet to another under condition

danijela_s3

New Member
Joined
Mar 6, 2009
Messages
1
Hi,
I need to copy data from one worksheet to another under condition.
For example, in the master sheet I have employee names with certian skill sets. These skill sets need to be divided on the separate worksheet that highlights only employees with that certain skill set.


Employee Name Skill 1 Skill 2 Skill 3
Employee 1 X X
Employee 2 X
Employee 3 X
Employee 4 X X
(note: x should be under different skill sets it does not show here well)

What would be the best formula to use here?

Thanks a lot!
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
This is the layout you presented. I've added a dropdown box in cell I1 that presents the skills to check.

Excel Workbook
ABCDEFGHI
1NAMESkill1Skill2Skill3NamesSkill2
2Emp 1XXEmp 1
3Emp 2XXEmp 3
4Emp 3XXEmp 4
5Emp 4XXX
Sheet1


Now, if you right-click on your sheettab and select VIEW CODE, this worksheet_change macro will watch the choice you make in cell I1 and give you a list of names in column H.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("I1")) Is Nothing Then
Dim lastrow As Long

lastrow = ActiveSheet.UsedRange.Rows.Count
Range("H2:H1000").ClearContents
    
    Select Case Range("I1").Value
        Case "Skill1"
            For Each ce In Range("B2:B" & lastrow)
                If ce.Value = "X" Then
                Range("H" & Cells(Rows.Count, 1).Row).End(xlUp).Offset(1, 0).Value = Range("A" & ce.Row).Value
                End If
            Next ce
        Case "Skill2"
            For Each ce In Range("C2:C" & lastrow)
                If ce.Value = "X" Then
                Range("H" & Cells(Rows.Count, 1).Row).End(xlUp).Offset(1, 0).Value = Range("A" & ce.Row).Value
                End If
            Next ce
        Case "Skill3"
            For Each ce In Range("D2:D" & lastrow)
                If ce.Value = "X" Then
                Range("H" & Cells(Rows.Count, 1).Row).End(xlUp).Offset(1, 0).Value = Range("A" & ce.Row).Value
                End If
            Next ce
        Case Else
        Exit Sub
    End Select
End If
End Sub
 
Upvote 0

Forum statistics

Threads
1,215,701
Messages
6,126,309
Members
449,309
Latest member
Ronaldj

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