Need help with AutoFilter coding

M

Malvaro

I'm using Excel 2003. Source data is a database-created spreadsheet of a
random amount of rows (anywhere from 3k-4k) with everchanging data. My
header row is row "2". My current coding is not functioning properly:

Selection.AutoFilter Field:=8, Criteria1:="DD"
Range("H3").Select
ActiveCell.FormulaR1C1 = "DDM"
Range("H3").Select
Selection.Copy
Range("H4:H5000").Select
ActiveSheet.Paste

Selection.AutoFilter Field:=8, Criteria1:="DM"
Range("H3").Select
ActiveCell.FormulaR1C1 = "DDM"
Range("H3").Select
Selection.Copy
Range("H4:H5000").Select
ActiveSheet.Paste
Selection.AutoFilter Field:=8

Within column H/8, I initially start with only three possible three
values: CC,DD,DM. I'm trying to modify my code to separately filter all
the instances of "DD" and "DM" and consolidate them into a new, joint
value "DDM". The desired result would be all the column results either
being CC or DDM.

I have reason to believe that my coding is not functioning due to my H3
reference which obviously could filter into any three values. However, I
do need to the consolidation changes to accurately update anything in
the H4:H5000 range. Ironically, other macros using the same scrubbing
code seem to work properly.

I know how to do this manually, but need to find functional VBA macro
code.

Any assistance you can offer would be greatly appreciated.

Thanks...
 
Top