slamet Harto
08-08-2008, 10:54 PM
All,
Can you advise me how to delete row if meet criteria.
Many thanks in advance.
Rgds, Harto
Sub DeleteUnprintedList()
Dim RangeToBeDeleted As Range
Dim xRowsCount As Long
Dim r As Long
Sheets(1).Activate
On Error Resume Next
Set RangeToBeDeleted = ActiveSheet.Range([B2], [B2].End(xlDown))
xRowsCount = RangeToBeDeleted.Rows.Count
Application.Calculation = xlCalculationManual
For r = xRowsCount To 1 Step -1
If Left(RangeToBeDeleted(r, 2), 4).Value = "9427" Or "9393" Or "9454" Or "9545" Or "9446" Or "9428" Or "9523" Then
RangeToBeDeleted(r, 2).EntireRow.Delete
End If
Next r
Application.Calculation = xlCalculationAutomatic
End Sub
Can you advise me how to delete row if meet criteria.
Many thanks in advance.
Rgds, Harto
Sub DeleteUnprintedList()
Dim RangeToBeDeleted As Range
Dim xRowsCount As Long
Dim r As Long
Sheets(1).Activate
On Error Resume Next
Set RangeToBeDeleted = ActiveSheet.Range([B2], [B2].End(xlDown))
xRowsCount = RangeToBeDeleted.Rows.Count
Application.Calculation = xlCalculationManual
For r = xRowsCount To 1 Step -1
If Left(RangeToBeDeleted(r, 2), 4).Value = "9427" Or "9393" Or "9454" Or "9545" Or "9446" Or "9428" Or "9523" Then
RangeToBeDeleted(r, 2).EntireRow.Delete
End If
Next r
Application.Calculation = xlCalculationAutomatic
End Sub