Hi,
Am writing a Sub that will delete all rows that do not contain 1 in Column B.
So far i have
Unfortunatley this deletes the "Total Row" and the "Headings"
Ideally i'd like to set the range first as this changes each time but not sure how to do this.
The code for the range that the For Next should run on is.
Where do i go from here.
Thanks as always for all your help.
Am writing a Sub that will delete all rows that do not contain 1 in Column B.
So far i have
Code:
Sub Macro14()
Dim ws As Worksheet
Set ws = ActiveSheet
For i = ws.Range("B5").End(xlDown).End(xlUp).Row To 1 Step -1
If ws.Cells(i, 2) <> "1" Then
ws.Rows(i).Delete
End If
Next
End Sub
Unfortunatley this deletes the "Total Row" and the "Headings"
Ideally i'd like to set the range first as this changes each time but not sure how to do this.
The code for the range that the For Next should run on is.
Code:
Range("B5", Range("A5").End(xlDown).Offset(-1, 1)).Select
Where do i go from here.
Thanks as always for all your help.