VBA Macro Action Based On AutoFilter Criteria

  • Hello
    I have a large worksheet which is autofilter (Autofilter Criteria Used) . If for example someone selects purchasing manager at the employment column then the spreadsheet will obviously only display purchasing managers. I have added the required VBA to determine what autofiltered criteria has been set which works -- this will be used later to determine when to hide columns -- i.e. if it is a purchasing manager I will hide the telephone number column.
    After I had determine the criteria I call a blank row count function which in the purchasing manager scenario should return 13 however it is currently returning 30 -- it seems to be returning all of my rows rather than just the ones that the autofiltered has remained. I am using the cells() referencing method in order to iterate through the remaining rows on the work sheet.
    Can anyone assist in advising why I am returning 30 rather than 13?
    With the ultimate aim as I said earlier it is to remove various columns which are redundant for various employment types which will be determined using the criteria set and the number of rows that are remaining.
    Any help greatly appreciated.
    Thanks j


    I have pasted my code below and have attached the dataset I'm using for testing.im using 2007 however i saved the dataset as 1997-2003.


  • Re: Autofilter Hide Column


    Does the following help?


Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!