R
Ron
Hello,
Some assistance please.
The code below is intended to delete the entire row if an “x” is in th
first column. It loops though all the sheets and all the populated row
in each sheet.
The problem appears to be in the way it moves though the rows.
If there are several continual rows with an “x” every other row i
deleted.
Thanks for the help.
Best Regards
Ron
Sub DeleteRecords()
' Delete records with an “x” in the first column
For sht = 1 To Worksheets.Count
Sheets(sht).Select
LastRow = ActiveSheet.UsedRange.Rows.Count
For x = 5 To LastRow 'set x value to first row of data
Cells(x, 1).Select
If LCase(ActiveCell.Value) = "x" Then
Selection.EntireRow.Delete
End If
Next x
Next sht
End Su
Some assistance please.
The code below is intended to delete the entire row if an “x” is in th
first column. It loops though all the sheets and all the populated row
in each sheet.
The problem appears to be in the way it moves though the rows.
If there are several continual rows with an “x” every other row i
deleted.
Thanks for the help.
Best Regards
Ron
Sub DeleteRecords()
' Delete records with an “x” in the first column
For sht = 1 To Worksheets.Count
Sheets(sht).Select
LastRow = ActiveSheet.UsedRange.Rows.Count
For x = 5 To LastRow 'set x value to first row of data
Cells(x, 1).Select
If LCase(ActiveCell.Value) = "x" Then
Selection.EntireRow.Delete
End If
Next x
Next sht
End Su