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...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Need Help with a VBA subroutine 0
Help me4 2
Macro File Names 2
File Names within a Macro Function 2
Different Results from the Same Macro 3
issue copying data 2
AutoFilter Criteria in VBA 5
BwiSwy Help Please 1

Top