如果与原始电子表格中的条件匹配,则在新电子表格中复制数据

在Excel 2010中

2个不同的电子表格

If Column B (Name) is = to "ABC Co" 'from Sheet2 

 If Column C (Category) is = to "A" 'from Sheet2 Copy "Part#" from Column A (Sheet2) into Sheet1 

注:重复值可以在B列(名称)和列C(类别)中findSheet2上的示例,在列A(Part#)中不重复

 **Sheet2** Column A Column B Column C Row 1 Part# Name: Category: Row 2 12340000 ABC Co A Row 3 12340001 DDD Inc A Row 4 12340002 Alpha Co A Row 5 12340003 ABC Co A Row 6 12340004 Alpha Co B Row 7 12340005 DDD Inc B Row 8 12340006 ABC Co B 

需要输出:

  *Sheet1* Column A Row 1 12340000 Row 2 12340003 

非常感谢你的帮助,只是一个提供的帮助,我花了相当长的时间寻找答案,但没有运气,不太熟悉协助我的search所需的术语,也调整适合我的个人情况是不是我最好的力量….希望有没有规则,我忽视了,但如果是这样,如果你可以请让我知道我会很乐意纠正。

你可以试试这个:

我希望我的意见清楚,否则就问我。

选项显式

 Sub MATCH() Dim ws1 As Worksheet: Set ws1 = ThisWorkbook.Sheets("Sheet1") 'Change the name of the sheet Dim ws2 As Worksheet: Set ws2 = ThisWorkbook.Sheets("Sheet2") 'Change the name of the sheet Dim ws2Lastrow As Long, i As Long ws2Lastrow = ws2.Range("A" & Rows.Count).End(xlUp).Row 'Find the lastrow in the Sheet(2) With ws2 ' Work within the sheet(2) For i = 2 To ws2Lastrow 'Start the Loop from row2 until the last row 'Put your two condition in order to copy the value in column Part# ' If the value in column B = "ABC Co" and column C = "A" If .Cells(i, "B").Value = "ABC Co" And .Cells(i, "C").Value = "A" Then 'Past the value in Sheet(1) column A in the first empty cell ws1.Cells(ws1.Range("A" & Rows.Count).End(xlUp).Row + 1, "A") = .Cells(i, "A").Value End If Next i End With End Sub