View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Pranav Vaidya Pranav Vaidya is offline
external usenet poster
 
Posts: 180
Default VBA Autofilter -- what if criteria doesn't exist? Error handling?

Hi,

I checked your code and it does not show any rows if I use it on my PC.

I think there must be some other lines in your code that are affecting the
view. For me the below line of code worked fine.

--
Pranav Vaidya
VBA Developer
PN, MH-India



"bertbarndoor" wrote:

Hi, I'm asking excel to update an autofilter with the following line:

Selection.AutoFilter Field:=61, Criteria1:="2"

However, I just noticed that 2 is not always in the list. In that
case, it doesn't auto filter anything and all rows are still visible.
Is there a way that I can get it to display zero rows if it can't
autofilter by the desired criteria?

Thanks, Rob (bertbarndoor)