这可能会有所帮助:
编辑在 OP 请求中添加的一些评论。
Sub Insert_blank_rows()
Dim i As Long
Dim LastRow As Long
'this code will run from last till first row which is required when inserting rows
'here we check last not-empty row to know which point to start from
LastRow = Cells(Rows.Count, 1).End(xlUp).Row
'start the loop from last not-empty direction first row
For i = LastRow To 1 Step -1
'if first cell in row is empty and there are some other not-empty cells
If Len(Cells(i, 1)) = 0 And Application.CountBlank(Rows(i)) <> Columns.Count Then
'we will insert empty row right below that row
Rows(i + 1).Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
End If
Next i
End Sub
一些信息:
- 它适用于活动表
- 我假设您问题中的第一列是工作表中的 A 列
-code 不检查行中是否有任何 % 符号,但依赖于您传递的其他信息(行中的第一个单元格为空,并且同一行中有一些其他单元格填充了值)
以下图片展示了之前和之后的状态。