【发布时间】:2015-02-10 15:33:21
【问题描述】:
全部。 我在上一篇文章中找到了一个解决了我大部分问题的解决方案。我只是需要一些帮助来扩展它。发布了以下宏(并且我已经为我的应用程序对其进行了修改)以在文本“CC Total”出现后添加一行。我需要这个宏在“CC Total”和文本“Sum Total”之后添加一行。如何将第二个条件添加到命令中?
Dim Col As Variant
Dim BlankRows As Long
Dim LastRow As Long
Dim R As Long
Dim StartRow As Long
Col = "A"
StartRow = 1
BlankRows = 1
LastRow = Cells(Rows.Count, Col).End(xlUp).Row
Application.ScreenUpdating = False
With ActiveSheet
For R = LastRow To StartRow + 1 Step -1
If .Cells(R, Col) = "CC Total" Then
.Cells(R + 1, Col).EntireRow.Insert Shift:=xlUp
End If
Next R
End With
Application.ScreenUpdating = True
【问题讨论】:
-
谢谢。让命令插入多于 1 行有多难?