Excel 如果满足条件,请在指定文本上方添加新行。如何更改该行的颜色?

Excel 如果满足条件,请在指定文本上方添加新行。如何更改该行的颜色?,excel,vba,Excel,Vba,需要为下面代码添加的新行上色。无法获得执行此操作的代码,请提供帮助,好吗 Dim sh As Worksheet Dim LstRw As Long, x Set sh = Sheets("RAW DATA FILE") With sh LstRw = .Cells(.Rows.Count, "A").End(xlUp).Row For x = LstRw To 2 Step -1 If .Cells(x, 1) Like "Customer accou

需要为下面代码添加的新行上色。无法获得执行此操作的代码,请提供帮助,好吗

Dim sh As Worksheet
Dim LstRw As Long, x

Set sh = Sheets("RAW DATA FILE")

With sh
    LstRw = .Cells(.Rows.Count, "A").End(xlUp).Row

    For x = LstRw To 2 Step -1
          If .Cells(x, 1) Like "Customer account" Then
               .Cells(x, 1).EntireRow.Insert
          End If
    Next x
End With

如果
x
行下移,则
.Cells(x,1).EntireRow
指的是新插入的行,您可以对该行进行着色。我是否在创建新行的行中写入要着色的代码?试过了,但没有在低于该值时工作=)谢谢,现在工作正常。:)