删除值为excel的行

我试图做一个代码,寻找一个文件扩展名,然后删除该行。这是我到目前为止

With Worksheets("ImportSheet") For lRow = 2 To .Cells(.Rows.Count, "A").End(xlUp).Row If Cells(lRow, 1).Value = "*xlsx" Then Rows(lRow).Delete End If Next End With 

但似乎没有做任何事情。 帮助非常感谢。 先谢谢你

尝试这个:

 With Worksheets("ImportSheet") For lRow = .Cells(.Rows.Count, 1).End(xlUp).Row To 2 Step -1 If Cells(lRow, 1).Value Like "*xlsx" Then Rows(lRow).Delete End If Next End With