+ Reply to Thread
Results 1 to 5 of 5

Code to Hide/Unhide columns if null when using Autofilter

  1. #1
    Registered User
    Join Date
    08-30-2012
    Location
    Saskatchewan
    MS-Off Ver
    Excel 2003
    Posts
    6

    Code to Hide/Unhide columns if null when using Autofilter

    I'm looknig for the EXACT code that I will need to Hide and Unhide columns if the columns have no data in them once an auto filter is applied on a specific column (A). In the attached I want to filter as an example Wheat, Red Spring in column A and have it hide all columns where Row 1 = 0. I need this to dynamically change each time a filter is applied. When All is selected in column A I want it to show all columns. In the Wheat example the results should be columns C & J.

    Is this possible? If there is a better way I'm open to any suggestions.
    Any help is apreciated!!
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    11-25-2008
    Location
    Poland
    MS-Off Ver
    MSO 2K3, 2K10
    Posts
    84

    Re: Code to Hide/Unhide columns if null when using Autofilter

    In sheet class module:
    Please Login or Register  to view this content.
    Artik
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    08-30-2012
    Location
    Saskatchewan
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Code to Hide/Unhide columns if null when using Autofilter

    I also need it to unhide all of the columns when I select ALL under the autfilter in column A?? Thanks!

  4. #4
    Registered User
    Join Date
    11-25-2008
    Location
    Poland
    MS-Off Ver
    MSO 2K3, 2K10
    Posts
    84

    Re: Code to Hide/Unhide columns if null when using Autofilter

    Please Login or Register  to view this content.
    Artik

  5. #5
    Registered User
    Join Date
    08-30-2012
    Location
    Saskatchewan
    MS-Off Ver
    Excel 2003
    Posts
    6

    Re: Code to Hide/Unhide columns if null when using Autofilter

    This works great. Thanks!! I may need Column A moved to column D as an example, so the filter would be applied in column D rather than A. I changed the "If Me.AutoFilter.Filters(1).On Then" to "If Me.AutoFilter.Filters(4).On Then" which works, but it then hides columns A - C. I would want all columns to the left of my filtered column to show at all times. Thanks

+ 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