+ Reply to Thread
Results 1 to 4 of 4

Filter Columns With Macro

Hybrid View

  1. #1
    Registered User
    Join Date
    06-10-2010
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2007
    Posts
    70

    Filter Columns With Macro

    I want to filter a specific column (Selecting two Names) the Run my macro. So in My case Select "Southwood" and uncheck everything else.

    This is what I have, but is not working
    Sub Filter()
    'Number 4 is the Column Number
    Dim r As Long
    For r = Cells(Rows.Count, 4).End(xlUp).Row To 1 Step -1
        If Cells(r, 4) = "Southwood" Then Rows(r).Select
    Next r
    Macro1
    End Sub
    Any Ideas??

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Filter Columns With Macro

    Hello nachousa,

    This macro will auto filter column "D" only on the active sheet for any cells that have "Southwood".
    Sub FilterColumn()
    
        With ActiveSheet
          .AutoFilterMode = False
          .Columns("D:D").AutoFilter Field:=1, Criteria1:="Southwood", VisibleDropDown:=True
        End With
        
    End Sub
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  3. #3
    Registered User
    Join Date
    06-10-2010
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2007
    Posts
    70

    Re: Filter Columns With Macro

    Thanks.. that wasn't too bad.
    I have a quick question that's unrelated but im a little stuck.
    I have a list of numbers. each with a bunch of zeros listed before the num.
    ex. 000000005608
    00000000000000067890
    I dont know why is showing like this but is there a way of removing the zeros before the num.
    reslut: 5608 and 67890

    Hope you can help!

  4. #4
    Registered User
    Join Date
    06-10-2010
    Location
    Atlanta, GA
    MS-Off Ver
    Excel 2007
    Posts
    70

    Re: Filter Columns With Macro

    Nevermind I got it. Thanks anyways

+ 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