Hudson
11-26-2016, 05:14 AM
Hi all ,
I have this code that does a simple job . only when criteria is met if not . it is going astray .
For example : below code filter column (K) " DA,DB,DZ" and put a a comment in adjacent column ("S") " Deduction". so far so good . But code is changing first cell of column ("S") even though documnt type (DA,DB,DZ) misses.
Sub filter_deduction()
Range("K1:K" & Range("K" & Rows.Count).End(3).Row).AutoFilter 1, Criteria1:=Array("DA", "DB", "DZ"), Operator:=xlFilterValues
Range("S2:S" & Range("K" & Rows.Count).End(3).Row).SpecialCells(12).Formula = "Deductions"
ActiveSheet.AutoFilterMode = False
End Sub
I have this code that does a simple job . only when criteria is met if not . it is going astray .
For example : below code filter column (K) " DA,DB,DZ" and put a a comment in adjacent column ("S") " Deduction". so far so good . But code is changing first cell of column ("S") even though documnt type (DA,DB,DZ) misses.
Sub filter_deduction()
Range("K1:K" & Range("K" & Rows.Count).End(3).Row).AutoFilter 1, Criteria1:=Array("DA", "DB", "DZ"), Operator:=xlFilterValues
Range("S2:S" & Range("K" & Rows.Count).End(3).Row).SpecialCells(12).Formula = "Deductions"
ActiveSheet.AutoFilterMode = False
End Sub