+ Reply to Thread
Results 1 to 4 of 4

Filter Option and Macros

Hybrid View

  1. #1
    Registered User
    Join Date
    07-19-2009
    Location
    toronto, Canada
    MS-Off Ver
    Excel 2003
    Posts
    18

    Filter Option and Macros

    Hello

    I have MS excel 2007

    the file I work with is very big around 200K lines ( its a csv file)

    I have a column in the file that lists email addresses

    some people did not put their email address correctly.

    so what I do is I do a column filter for example for anything that ends with @yahoo , and then I change the results to @yahoo.com

    or for example some people put @yahoo,com , so I filter that and change the filtered results to @yahoo.com

    is there way to create a macro to do different types of filters and edit the results , instead of doing each one manually?

  2. #2
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: Filter Option and Macros

    Just use the built-in search and replace.

    Select the column, press Ctrl+F keys.

    Find what: yahoo*

    Replace With: yahoo.com

    Replace All

  3. #3
    Registered User
    Join Date
    07-19-2009
    Location
    toronto, Canada
    MS-Off Ver
    Excel 2003
    Posts
    18

    Re: Filter Option and Macros

    hello, thanks for the fast reply.

    How can make a macro just edit the results of a filter?

    I have the following macro

    Sub filteryahoo()
    '
    ' filteryahoo Macro
    ' @yahoo
    '

    '
    Selection.AutoFilter
    ActiveSheet.Range("$A$1:$O$195631").AutoFilter Field:=3, Criteria1:= _
    "=*@yahoo", Operator:=xlAnd
    End Sub


    It will basically filter column #3 with any cells that end with @yahoo
    I want to be able to have the macro change only the results of the filter from @yahoo to @yahoo.com

    I know there might better ways to change @yahoo to @yahoo.com, but I am looking to see how the macro can edit only the search results of a filter.

    any ideas?

  4. #4
    Forum Expert Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007, 2010
    Posts
    3,978

    Re: Filter Option and Macros

    Record a macro using the search and replace as I described it and you will have the basic macro code.

    However, you should always opt for using the built-in functionality of Excel before looking for a VBA solution because native functions/features are much faster and more efficient than ANY VBA code.

+ 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