I have a macro-enabled sheet which has three worksheets. I want to delete the entire row if the value in column F is "T" only from sheet1. Here's the code I tried:
Sub RemoveRows() Dim i As Long Set ws = Sheets("Sheet1") lRow = ws.Range("F" & Rows.Count).End(xlUp).Row With ws For i = 2 To lRow If InStr(.Range("F" & i), "T") > 0 Then ThisWorkbook.ActiveSheet.Range("F" & i).EntireRow.Delete End If Next i End With Application.ScreenUpdating = True End Sub
It deleted the rows, but not completely. Still, I can see the value "T" in column F. Can anyone please point out me with the wrong in the code?
https://stackoverflow.com/questions/65750505/excel-vba-delete-the-entire-row-based-on-the-condition January 16, 2021 at 10:00PM
没有评论:
发表评论