Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default filter problem

Hiya,

I have a combobox (not the form one) set up with three options - from the selection it will action a filter in one column. For some reason the on-change code isn't working. Can anyone tell me why not/how to get it to work?

cells a6-a8 are the combobox listfillrange
cell a4 is the linked cell
the error is given as run-time '1004' Autofilter method of range class failed.

The autofilter arrow only exists on cell a5.

Here is the code:

Private Sub ComboBox1_Change()

Dim StatusSelected As String

StatusSelected = Range("A4").Value 'For some reason it won't accept .Text
Range("A5").AutoFilter Field:=1, Criteria1:="=" & Left(StatusSelected, 5) & "*"

End Sub

Thanks loads,

Basil
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default filter problem

Try adding the line

Activecell.Activate

before you run the autofilter, it could be that the
combobox has the active focus. On a command button thereis
a property TakeFocusOnClick which can be set to False but
I don't think there is one for combo boxes.

-----Original Message-----
Hiya,

I have a combobox (not the form one) set up with three

options - from the selection it will action a filter in
one column. For some reason the on-change code isn't
working. Can anyone tell me why not/how to get it to work?

cells a6-a8 are the combobox listfillrange
cell a4 is the linked cell
the error is given as run-time '1004' Autofilter method

of range class failed.

The autofilter arrow only exists on cell a5.

Here is the code:

Private Sub ComboBox1_Change()

Dim StatusSelected As String

StatusSelected = Range("A4").Value 'For some

reason it won't accept .Text
Range("A5").AutoFilter Field:=1, Criteria1:="=" & Left

(StatusSelected, 5) & "*"

End Sub

Thanks loads,

Basil
.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default filter problem

Genius

So simple, I've spent about 15 hours trying to get around the problem. Thankyou so much

Ba

----- Gavin wrote: ----

Try adding the lin

Activecell.Activat

before you run the autofilter, it could be that the
combobox has the active focus. On a command button thereis
a property TakeFocusOnClick which can be set to False but
I don't think there is one for combo boxes

-----Original Message----
Hiya
I have a combobox (not the form one) set up with three

options - from the selection it will action a filter in
one column. For some reason the on-change code isn't
working. Can anyone tell me why not/how to get it to work
cells a6-a8 are the combobox listfillrang

cell a4 is the linked cel
the error is given as run-time '1004' Autofilter method

of range class failed
The autofilter arrow only exists on cell a5
Here is the code
Private Sub ComboBox1_Change(
Dim StatusSelected As Strin
StatusSelected = Range("A4").Value 'For some

reason it won't accept .Tex
Range("A5").AutoFilter Field:=1, Criteria1:="=" & Lef

(StatusSelected, 5) & "*
End Su
Thanks loads
Basi



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Filter problem Ray[_7_] Excel Worksheet Functions 1 June 22nd 11 01:15 AM
Filter problem Ray[_7_] New Users to Excel 1 June 22nd 11 12:25 AM
Filter problem cumi Excel Worksheet Functions 1 April 3rd 07 05:10 AM
filter problem strictly_rhythm Excel Discussion (Misc queries) 6 July 4th 06 12:24 PM
filter problem strictly_rhythm Excel Discussion (Misc queries) 1 July 3rd 06 09:49 PM


All times are GMT +1. The time now is 08:40 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"