Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default Combo Box - Please Help!

I have posted this twice before and cannot get a response! Please help
me out. Thanks, Chris


Hi-


I have a combo box that is populated by a list in the same sheet. The
combo box contains 4 different categories of data that when clicked
will autofilter the sheet named "excel" based on which category was
selected in the combo box.


Here is the code have:


Private Sub ComboBox1_Change()


Sheets("excel").Select
Selection.AutoFilter Field:=8, Criteria1:="=0"
Selection.AutoFilter Field:=10, Criteria1:="=1"


What I want to add to this code is an If Statement that will change the

sort based on what is selected in the combo. So say the combo has 4
entries: 1,2,3,4. Let's say the user selects 3 this time and then
comes back and selects 4. Here is what I would like to do:


Private Sub ComboBox1_Change()


If (Value selected in Combo box) Is 3 Then
Sheets("excel").Select
Selection.AutoFilter Field:=8, Criteria1:="=0"
Selection.AutoFilter Field:=10, Criteria1:="=1"


End If


If (Value selected in Combo box) Is 4 Then
Sheets("excel").Select
Selection.AutoFilter Field:=8, Criteria1:="=0"
Selection.AutoFilter Field:=10, Criteria1:="=1"


End If


I may be better served with a Select Case....but either way I do not
know how to code. Can you offer your suggestion on a if vs. a select
and how to code each one?


HUGE thanks in advance for your time and help!


-Chris

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Combo Box - Please Help!

What is different between the 3 case and the 4 case?

--
HTH

Bob Phillips

wrote in message
oups.com...
I have posted this twice before and cannot get a response! Please help
me out. Thanks, Chris


Hi-


I have a combo box that is populated by a list in the same sheet. The
combo box contains 4 different categories of data that when clicked
will autofilter the sheet named "excel" based on which category was
selected in the combo box.


Here is the code have:


Private Sub ComboBox1_Change()


Sheets("excel").Select
Selection.AutoFilter Field:=8, Criteria1:="=0"
Selection.AutoFilter Field:=10, Criteria1:="=1"


What I want to add to this code is an If Statement that will change the

sort based on what is selected in the combo. So say the combo has 4
entries: 1,2,3,4. Let's say the user selects 3 this time and then
comes back and selects 4. Here is what I would like to do:


Private Sub ComboBox1_Change()


If (Value selected in Combo box) Is 3 Then
Sheets("excel").Select
Selection.AutoFilter Field:=8, Criteria1:="=0"
Selection.AutoFilter Field:=10, Criteria1:="=1"


End If


If (Value selected in Combo box) Is 4 Then
Sheets("excel").Select
Selection.AutoFilter Field:=8, Criteria1:="=0"
Selection.AutoFilter Field:=10, Criteria1:="=1"


End If


I may be better served with a Select Case....but either way I do not
know how to code. Can you offer your suggestion on a if vs. a select
and how to code each one?


HUGE thanks in advance for your time and help!


-Chris



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default Combo Box - Please Help!

Bob-

The filter code. So let's say #3 is all products that are blue and
weigh over 5 lbs and #4 is all products that are red and weigh under 5
pounds.

The combo drop box would contain the selection and when the person
clicks into the combo box and selects what they want to see....the
sheet will filter based on what they select.

Thanks for responding and lending a hand....I appreciate it.

-Chris

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
linking a form combo box... results from the combo box to another Trey Excel Discussion (Misc queries) 1 July 15th 07 01:58 AM
combo reference on another combo box for picking address etc. kbjin Excel Worksheet Functions 1 December 8th 06 03:29 PM
"Combo Box - getting control combo box to stick in place in worksh ajr Excel Discussion (Misc queries) 1 February 16th 05 02:05 AM
"Combo Box - getting control combo box to stick in place in worksh ajr Excel Discussion (Misc queries) 0 February 15th 05 07:45 PM
Combo Box - Hide Combo Box w/Check Box Paul Excel Programming 5 December 3rd 04 10:58 PM


All times are GMT +1. The time now is 04:11 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"