ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help with filter code. (https://www.excelbanter.com/excel-programming/376365-help-filter-code.html)

J.W. Aldridge

Help with filter code.
 
The initial code works fine. I have simply changed the criteria.
I played around with the following however, i have been unsuccessful.
I need to change the following formula to reflect the new criteria.

Old criteria:
Filter everything in column A beginning with row 12 and place it in
column B (a single instance list) starting with row 12.


New criteria:
Filter everything in column F beginning with row 17 and place it in
column Q (a single instance list) starting with row 17.


Any advice?


Private Sub Worksheet_Change(ByVal Target As Range)
Dim myRow As Long
If Target.Cells.Count 1 Then Exit Sub
If Target.Column < 1 Then Exit Sub
Application.EnableEvents = False
If Application.CountIf(Range("B:B"), Target.Value) = 0 Then
rw = Range("B65536").End(xlUp)(2).Row
If rw < 12 Then rw = 12
Cells(rw, 2).Value = Target.Value
End If
For myRow = Range("B65536").End(xlUp).Row To 12 Step -1
If IsError(Application.Match(Cells(myRow, 2).Value, Range("A:A"),
False)) Then
Cells(myRow, 2).ClearContents
End If
Next myRow
Application.EnableEvents = True
End Sub



All times are GMT +1. The time now is 06:29 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com