Home > Article > Software Tutorial > How to operate a sorted table in EXCEL and add multiple blank rows between different names
is less, right-click the line number and select Insert. A row will be inserted in front. Repeat several times.
If there are more, use vba programming.
Create a macro. Copy this code, change "D" to the letter of the column you want to determine duplicates, and then run it.
For i = ActiveSheet.UsedRange.Cells.Rows.Count To 2 Step -1
If Len(Trim(ActiveSheet.Cells(i, "D").Value)) = 0 Then
Else
If Trim(ActiveSheet.Cells(i - 1, "D").Value) Trim(ActiveSheet.Cells(i, "D").Value) Then
Rows(i).Insert
End If
End If
Next
Use VBA to design a command button and enter the following code:
Private Sub CommandButton1_Click()
Range("C:D").ClearContents
k = 1
For Each rag In Range("A:A")
If rag.Value = """ Then Exit For
For j = 1 To Len(Trim(rag.Offset(, 1)))
Range("C" & k) = rag.Value
Range("D"& k) = Mid(Trim(rag.Offset(, 1).Value), j, 1)
k = k 1
Next j
Next
End Sub
The above is the detailed content of How to operate a sorted table in EXCEL and add multiple blank rows between different names. For more information, please follow other related articles on the PHP Chinese website!