Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Filtering Values using a Combobox


Another way is to check first:

Option Explicit
Sub testme()
Dim wks As Worksheet
Set wks = ActiveSheet
With wks
If .FilterMode Then
.ShowAllData
End If
End With
End Sub

teresa wrote:

I have three values in a combobox:
Quant,Qual,Both

There is a list: 10 Quant,10 Qual and 10 Both
When the user chooses Quant, only Quant values are shown etc.

The below code is failing at ActiveSheet.ShowAllData

I'm trying the code below:

Sub ComboBox1_Click()
Call filt
End Sub

Sub filt()
If ComboBox1.Value = "Qual" Then
ActiveSheet.ShowAllData
Range("Letters").AutoFilter Field:=2, Criteria1:="Qual"
Else
If ComboBox1.Value = "Quant" Then
ActiveSheet.ShowAllData
Range("Letters").AutoFilter Field:=1, Criteria1:="Quant"
Range("a8").EntireRow.Hidden = True
Else
If ComboBox1.Value = "Both" Then
ActiveSheet.ShowAllData

Range("a8").EntireRow.Hidden = True
End If
End If
End If
End Sub


--

Dave Peterson
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
Values of ComboBox fields and SQL Ant(antonfh_at_gmail_dot_com) Excel Discussion (Misc queries) 3 May 23rd 06 02:03 PM
Combobox and data values fragher75[_8_] Excel Programming 1 October 20th 04 01:15 PM
ComboBox Values Jim Berglund Excel Programming 4 August 17th 04 10:18 PM
Filtering ComboBox shrekut[_3_] Excel Programming 2 January 15th 04 02:09 PM
ComboBox Values Darren[_3_] Excel Programming 1 July 16th 03 10:41 AM


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