Reputation: 25
I am trying to make a code that looks for a file extension then deletes that row.This is what I have so far
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
But it doesn't seem to do anything. Help greatly appreciated. Thank you in advance
Upvotes: 1
Views: 39
Reputation: 553
Try this:
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
Upvotes: 1