Home > Software Tutorial > Office Software > How to operate a sorted table in EXCEL and add multiple blank rows between different names

How to operate a sorted table in EXCEL and add multiple blank rows between different names

PHPz
Release: 2024-01-17 09:30:16
forward
1460 people have browsed it

How to operate a sorted table in EXCEL and add multiple blank rows between different names

How to add multiple blank rows between different names in a column in a table after EXCEL sorting If

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

Each word in an excel cell occupies one line

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!

source:docexcel.net
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template