+ Reply to Thread
Results 1 to 4 of 4

AutoFilter coding

  1. #1
    Registered User
    Join Date
    12-12-2005
    Location
    USA
    MS-Off Ver
    2007 with XP Pro
    Posts
    25

    AutoFilter coding

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

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    See if link helps

    http://www.rondebruin.nl/copy5.htm

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  3. #3
    Registered User
    Join Date
    12-12-2005
    Location
    USA
    MS-Off Ver
    2007 with XP Pro
    Posts
    25
    Quote Originally Posted by VBA Noob
    See if link helps

    http://www.rondebruin.nl/copy5.htm

    VBA Noob
    I read through the link and I couldn't find any code that could fix my Excel problem...

  4. #4
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Not 100% sure what your trying to do.

    This will filter data on the activesheet to Sheet2 in Col G (Criteria used DD & DDM. Change to your criteria)

    Please Login or Register  to view this content.
    VBA Noob

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1