Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Access the values from combo box after autofiltering

I would like to access from VBA code the values from combo box afte
autofiltering.

Ex: (All), (Top10...), (Custom...), 1, 2, 3, 4...

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Access the values from combo box after autofiltering

Public Function ShowFilter(rng As Range)
Dim filt As Filter
Dim sCrit1 As String
Dim sCrit2 As String
Dim sop As String
Dim lngOp As Long
Dim lngOff As Long
Dim frng As Range
Dim sh As Worksheet
Set sh = rng.Parent
If sh.FilterMode = False Then
ShowFilter = "No Active Filter"
Exit Function
End If
Set frng = sh.AutoFilter.Range

If Intersect(rng.EntireColumn, frng) Is Nothing Then
ShowFilter = CVErr(xlErrRef)
Else
lngOff = rng.Column - frng.Columns(1).Column + 1
If Not sh.AutoFilter.Filters(lngOff).On Then
ShowFilter = "No Conditions"
Else
Set filt = sh.AutoFilter.Filters(lngOff)
On Error Resume Next
sCrit1 = filt.Criteria1
sCrit2 = filt.Criteria2
lngOp = filt.Operator
If lngOp = xlAnd Then
sop = " And "
ElseIf lngOp = xlOr Then
sop = " or "
Else
sop = ""
End If
ShowFilter = sCrit1 & sop & sCrit2
End If
End If
End Function

demonstrates one approach.

=filter(b9)

would show the filter criteria for column B

--
Regards,
Tom Ogilvy

"stefantem " wrote in message
...
I would like to access from VBA code the values from combo box after
autofiltering.

Ex: (All), (Top10...), (Custom...), 1, 2, 3, 4....


---
Message posted from http://www.ExcelForum.com/



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
Populating a list/combo box with an Access column. kelsey Excel Discussion (Misc queries) 0 January 24th 07 03:19 PM
combo box and access hitesh via OfficeKB.com New Users to Excel 1 September 26th 06 04:04 PM
Combo Box Values from Access Table? Fattire Excel Discussion (Misc queries) 0 May 24th 05 06:12 PM
registering the cell values of excel combo box associated values john_stevens Excel Programming 1 May 21st 04 09:39 PM
Populating a lis/combo box in excel with access data Enrico Lisk Excel Programming 1 October 3rd 03 01:12 PM


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

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

About Us

"It's about Microsoft Excel"