答案 0 :(得分:1)
我不想为你做这件事,因为你甚至没有尝试解决它。但我太无聊了。 试试这个。
Sub mergeSmilar()
'mydata starts from 1
Dim i As Integer
i = 2
Do While (i <= Range("A" & Rows.Count).End(xlUp).Row)
If (Range("A" & i) = Range("A" & i - 1)) And (Range("B" & i) = Range("B" & i - 1)) Then
'row i should be merged to the i-1 row
For j = 3 To 7 ' change 7 to number of columns you need to merge
If (Trim(Cells(i - 1, j)) = "") Then
Cells(i - 1, j) = Cells(i, j)
End If
Next j
Range("A" & i).EntireRow.Delete
Else
i = i + 1
End If
Loop
End Sub