我想选择黄色数据并插入另一张纸中的行而不重复。
答案 0 :(得分:0)
这样的东西?
Dim i as Integer, iWS2
Dim WS1 as WorkSheet, WS2 as WorkSheet
Set WS1 = Sheets("Name WS1")
Set WS2 = Sheets("Name WS2")
i = 2
iWS2 = 1
Do Until WS1.Cells(i, 11).value = ""
If LCase(WS1.Cells(i, 11).value) = "nationality" Then
WS2.Range(Cells(iWS2, 1), Cells(iWS2, 13)).value = WS1.Range(Cells(i, 1), Cells(i, 13)).value
WS2.Cells(iWS2, 14).value = WS1.Cells(i + 1, 13).value
'I'd recommend to put all info of every student in the same row
'Do the same for the other cells
iWS2 = iWS2 + 1
End If
i = i + 1
Loop
Set WS1 = Nothing
Set WS2 = Nothing