+ Reply to Thread
Results 1 to 15 of 15

Turning off AutoFilter via VBA does not seem to work for this file.

  1. #1
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,662

    Turning off AutoFilter via VBA does not seem to work for this file.

    Hi, i am enclosing a file. When i try to turn off auto filters on this file ......nothing happens.

    I used the following code to turn off autofilters but it does not work:


    Please Login or Register  to view this content.

    Any ideas why? This file seems different in some way.......any ideas?
    Attached Files Attached Files

  2. #2
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,260

    Re: Turning off AutoFilter via VBA does not seem to work for this file.

    It's a Table, which has the autofilter built-in and it's not the same as the worksheet's autofilter.
    Remember what the dormouse said
    Feed your head

  3. #3
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,662

    Re: Turning off AutoFilter via VBA does not seem to work for this file.

    ok so how do i remove this autofilter? Do i have to remove/undo the table somehow..........?

  4. #4
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,260

    Re: Turning off AutoFilter via VBA does not seem to work for this file.

    You can use:
    Please Login or Register  to view this content.
    if you really want.

  5. #5
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,662

    Re: Turning off AutoFilter via VBA does not seem to work for this file.

    ok...that worked........but i have another question. if this is a table then can i apply normal worksheet autofilter via vba or am i going to have problems?

  6. #6
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,662

    Re: Turning off AutoFilter via VBA does not seem to work for this file.

    ok it does not work.........let me know if you want me to start anotehr thread.

    turning off filter per your code does work but for some reason i try to turn to turn autofilters back on via this code and it does not work.

    Please Login or Register  to view this content.

    i think it has to do with the fact that this is a table...........is there some way to make this just a normal file again? or i guess my code could be wrong but i have used this before and it has worked ok

  7. #7
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,260

    Re: Turning off AutoFilter via VBA does not seem to work for this file.

    As always, define "does not work".
    Since you apply a filter to a range, it should work, though the filter will not be the worksheet's filter, it will be the listobject's filter.

  8. #8
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,662

    Re: Turning off AutoFilter via VBA does not seem to work for this file.

    ok, here is what i am trying to do and it is not working.

    I apply a filter then delete all the rows that are "showing" then unfilter and work with whats remaining.

    The code i posted does not work............


    so i have two options that i can see
    1) continue working with data as as "table"......which have never done before
    2) some how remove table instance without affecting underlying data....

    any ideas?

  9. #9
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,260

    Re: Turning off AutoFilter via VBA does not seem to work for this file.

    When I ask you to define 'doesn't work', I mean clarify, not repeat. (i.e. in what way specifically does it not work?) Imagine you are taking your car to the garage - do you just say "it doesn't work - fix it"?

    Anyway, you can use:
    Please Login or Register  to view this content.
    to convert from table to normal range.

  10. #10
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,662

    Re: Turning off AutoFilter via VBA does not seem to work for this file.

    ok, sorry i did not get what you were asking for.

    Let me try to explain. Lets suppose i want to filter on "Header5" such that i want to show all the entries in this column which do NOT equal "Pre-Defined". I use the following code to do this


    Please Login or Register  to view this content.
    I stop the macro just after the above code and while the filters are there.....it is not filtered the way i want it......but i have used this type of code before and it has worked just fine.

    does this explain what you were asking?

  11. #11
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,662

    Re: Turning off AutoFilter via VBA does not seem to work for this file.

    also, i looked up how to convet from a table to normal worksheet and they said to do it manually do this

    Table Tools => Tools => Convert to Range

    Problem is that when i look at the insert menu and then the "Tables" submenu.....the Tables selection is greyed out.......does this mean its not a table?

  12. #12
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,662

    Re: Turning off AutoFilter via VBA does not seem to work for this file.

    ok, found out how to manually convert to range......i had to select region in table then above "Design" ....the words "Table Tools" appeared.....so i clicked on Design and found convert to range.

  13. #13
    Forum Expert romperstomper's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365, varying versions/builds
    Posts
    21,260

    Re: Turning off AutoFilter via VBA does not seem to work for this file.

    Quote Originally Posted by welchs101 View Post
    ok, sorry i did not get what you were asking for.

    Let me try to explain. Lets suppose i want to filter on "Header5" such that i want to show all the entries in this column which do NOT equal "Pre-Defined". I use the following code to do this


    Please Login or Register  to view this content.
    I stop the macro just after the above code and while the filters are there.....it is not filtered the way i want it......but i have used this type of code before and it has worked just fine.

    does this explain what you were asking?
    Need more detail in the "it is not filtered the way i want " part please - how is it filtered?

  14. #14
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,662

    Re: Turning off AutoFilter via VBA does not seem to work for this file.

    ok romperstomper,

    as always thanks. i added this code to my vba code as you instructed.....

    Please Login or Register  to view this content.
    and then applied my normal vba code..........and BAM!!!!!! it worked.

    thanks.

  15. #15
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,662

    Re: Turning off AutoFilter via VBA does not seem to work for this file.

    just for completeness,

    the way that i wanted the file sorted is as follows:

    Lets suppose i want to filter on "Header5" such that i want to show all the entries in this column which do NOT equal "Pre-Defined". In the test file i sent i would have to change the values in header5 column so taht some of teh entries were actually "Pre-Defined". I did that and what happed (while file was a TABLE) is that nothing happened.......ALL the values in the column were shown no filter was applied.

    but after applying the code that romperstomper indicated to convert table back to normal worksheet........my vba code for applying the filter worked as expected.

+ 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