Hi all:
Hope I can get your assistance on the following: Before I run my main code in excel, I would like to turn off the autofilter. My code runs a filter and then searches for a value. Then it runs another filter and then searches for a different value.
My question is: How do I write a code so that excel turns off the filter before running the main code. I tried using:
Rows("1:1").Select
Selection.AutoFilter
But it doesn't work on occasions because my code exits the sub, my code exists the sub if excel does not find the value. So, when I run another code that contains the value being searched, the code does not work properly, because the autofilter has not been turned off, the code above does not do the job.
What code would I use to turn the autofilter off before a new code is run.
thanks for helping
SharonMee
Hope I can get your assistance on the following: Before I run my main code in excel, I would like to turn off the autofilter. My code runs a filter and then searches for a value. Then it runs another filter and then searches for a different value.
My question is: How do I write a code so that excel turns off the filter before running the main code. I tried using:
Rows("1:1").Select
Selection.AutoFilter
But it doesn't work on occasions because my code exits the sub, my code exists the sub if excel does not find the value. So, when I run another code that contains the value being searched, the code does not work properly, because the autofilter has not been turned off, the code above does not do the job.
What code would I use to turn the autofilter off before a new code is run.
thanks for helping
SharonMee