Private Sub CommandButton1_Click()
Dim i As Integer
Dim strB, strC As Range
For i = [B2].End(xlDown).Row To 2 Step -1
Set strB = Cells(i - 1, 2)
Set strC = Cells(i, 2)
If strC.Value = strB.Value Then
If strB.Offset(0, 1) = "" And strC.Offset(0, 1) <> "" Then
strB.Offset(0, 1) = strC.Offset(0, 1)
End If
If strB.Offset(0, 2).Value = "" And strC.Offset(0, 2).Value <> "" Then
strB.Offset(0, 2).Value = strC.Offset(0, 2).Value
End If
strC.EntireRow.Delete
End If
Next
End Sub作者: yen956 時間: 2014-2-23 10:31