ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Autofilter works... just not in my ListBox_click! (https://www.excelbanter.com/excel-programming/320552-autofilter-works-just-not-my-listbox_click.html)

Mike

Autofilter works... just not in my ListBox_click!
 
Arrrggg!!!
I have this code that worked PERFECTLY when I use it on a Label_Click but
it doesn't work when I copy it into a Listbox "Click".

I get the following error:
"Error 1004 - Autofilter Method of Range Class Failed"

Private Sub TestText_Click()
Call Reset_Filters
Worksheets("Open Issues").Range("OpenIssues").AutoFilter _
field:=4, _
Criteria1:="Gustavo"
Worksheets("Open Issues").Range("OpenIssues").AutoFilter _
field:=14, _
Criteria1:="="
End Sub

This is SO frustrating because it worked fine an Hour Ago, and if I copy it
to a label or text box, it works just fine.... Did I change a property
without knowing it?

gocush[_29_]

Autofilter works... just not in my ListBox_click!
 
1 idea comes to mind:

The listbox has a link cell associated with it. Is it possible that the
link cell is inside your "OpenIssues" range?
I don't use listboxes but often use comboboxes. I have to be very careful
with
the link cell changing and setting up a continuous loop.


"Mike" wrote:

Arrrggg!!!
I have this code that worked PERFECTLY when I use it on a Label_Click but
it doesn't work when I copy it into a Listbox "Click".

I get the following error:
"Error 1004 - Autofilter Method of Range Class Failed"

Private Sub TestText_Click()
Call Reset_Filters
Worksheets("Open Issues").Range("OpenIssues").AutoFilter _
field:=4, _
Criteria1:="Gustavo"
Worksheets("Open Issues").Range("OpenIssues").AutoFilter _
field:=14, _
Criteria1:="="
End Sub

This is SO frustrating because it worked fine an Hour Ago, and if I copy it
to a label or text box, it works just fine.... Did I change a property
without knowing it?


Mike

Autofilter works... just not in my ListBox_click!
 
No, the list box is linked to a different range on a hidden sheet.
I finally stumbled on the "On Error Resume Next" command and it works
fine... I just wish I knew why it crashes but when it resumes, it works
perfect....

Thanks for the feedback,
Mike

"gocush" wrote:

1 idea comes to mind:

The listbox has a link cell associated with it. Is it possible that the
link cell is inside your "OpenIssues" range?
I don't use listboxes but often use comboboxes. I have to be very careful
with
the link cell changing and setting up a continuous loop.


"Mike" wrote:

Arrrggg!!!
I have this code that worked PERFECTLY when I use it on a Label_Click but
it doesn't work when I copy it into a Listbox "Click".

I get the following error:
"Error 1004 - Autofilter Method of Range Class Failed"

Private Sub TestText_Click()
Call Reset_Filters
Worksheets("Open Issues").Range("OpenIssues").AutoFilter _
field:=4, _
Criteria1:="Gustavo"
Worksheets("Open Issues").Range("OpenIssues").AutoFilter _
field:=14, _
Criteria1:="="
End Sub

This is SO frustrating because it worked fine an Hour Ago, and if I copy it
to a label or text box, it works just fine.... Did I change a property
without knowing it?



All times are GMT +1. The time now is 10:29 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com