Morning All,
xld recently helped me out with a filtering problem, essentially the code he helped with identifies specific cell reference criteria then, if the criteria is met the entire row is deleted (code below);
Private Sub DeleteUnwanted(ByVal sh As String, _
ByVal TestColumn As Long, _
ByVal Criteria As String)
'// Filter the nominated column on nominated criteria and delete all visible rows
Dim cRows As Long
With Worksheets(sh)
On Error Resume Next
'first, count the rows to operate on
cRows = .Cells(.Rows.Count, TestColumn).End(xlUp).Row
'finally, apply the autofilter for al matching cells
.Columns(TestColumn).AutoFilter Field:=1, Criteria1:=Criteria, Operator:=xlAnd
'we now have only matching rows visible, so we can
'delete these matching rows
With .Cells(2, TestColumn).Resize(cRows - 1)
.SpecialCells(xlCellTypeVisible).EntireRow.Delete
End With
.Columns(TestColumn).AutoFilter
On Error GoTo 0
End With
End Sub
What I would like to do now, is use the filtering method to identify if a cell contains "N", if it does then the cell 2 to the left (RC[-2]) will have to be changed to equal the value of the cell one to the left (RC[-1])
I am struggling with how to edit the code to do this.
Any help greatly appreciated.
Marshybid