Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Filter on cell value?


Is it possible to have a column of multiple values and by clicking i
the cell, it filters on that value

--
QuickLearne
-----------------------------------------------------------------------
QuickLearner's Profile: http://www.excelforum.com/member.php...fo&userid=3548
View this thread: http://www.excelforum.com/showthread.php?threadid=55622

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Filter on cell value?

Try

Dim WS As Worksheet
Set WS = ActiveSheet
WS.UsedRange.AutoFilter
WS.UsedRange.AutoFilter Field:=ActiveCell.Column,
Criteria1:=ActiveCell.Value


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"QuickLearner"
wrote
in message
news:QuickLearner.2a2vkk_1151440557.4363@excelforu m-nospam.com...

Is it possible to have a column of multiple values and by
clicking in
the cell, it filters on that value?


--
QuickLearner
------------------------------------------------------------------------
QuickLearner's Profile:
http://www.excelforum.com/member.php...o&userid=35483
View this thread:
http://www.excelforum.com/showthread...hreadid=556224



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 75
Default Filter on cell value?

You could attach the following code to a menu item, and then clicking
the menu item would filter based on the ActiveCell. (I think the way
this will post will show some lines as wrapping.)

Sub FilterOnActiveCell()

Dim j As Long

If ActiveSheet.AutoFilterMode = False Then
' If the sheet does not have an Autofilter, exit
MsgBox "There is no filter on this sheet."
Exit Sub
Else
If Intersect(ActiveSheet.AutoFilter.Range, ActiveCell) Is
Nothing Then
' No overlap between AutoFilter range and ActiveCell
MsgBox "The ActiveCell is not within the filtered range."
Exit Sub
Else
j = ActiveCell.Column -
ActiveSheet.AutoFilter.Range.Columns(1).Column + 1
If Application.IsText(ActiveCell) Then
' Cell to filter on may contain blanks, so leave them
in
ActiveSheet.AutoFilter.Range.AutoFilter _
Field:=j, _
Criteria1:=ActiveCell.Text
Else
' Take out any blanks in ActiveCell.Text that may
result from the way
' numbers are formatted, e.g., from accounting format
ActiveSheet.AutoFilter.Range.AutoFilter _
Field:=j, _
Criteria1:=Application.Substitute(ActiveCell.Text,
" ", "")
End If
End If
End If
End Sub


Mark


QuickLearner wrote:
Is it possible to have a column of multiple values and by clicking in
the cell, it filters on that value?


--
QuickLearner
------------------------------------------------------------------------
QuickLearner's Profile: http://www.excelforum.com/member.php...o&userid=35483
View this thread: http://www.excelforum.com/showthread...hreadid=556224


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
How to filter on a color of a cell [email protected] Excel Discussion (Misc queries) 3 April 27th 15 01:18 PM
Adv Filter with Ref Cell JICDB Excel Worksheet Functions 1 August 22nd 07 03:45 PM
Can I filter just one cell instead of the whole row? Some Dude Excel Discussion (Misc queries) 6 July 27th 06 08:25 PM
Cell filter deletion Sergio Excel Discussion (Misc queries) 2 January 6th 06 06:54 PM
last cell in filter scrabtree[_2_] Excel Programming 1 August 1st 04 05:30 PM


All times are GMT +1. The time now is 04:28 PM.

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"