Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As
Boolean) Dim Selected Set Selected = ActiveCell Sheets("Notes").Select Selection.AutoFilter Field:=1, Criteria1:=ActiveCell.Value, Operator:=xlAnd End Sub When I right click a cell, it filters using the value from the cell. Unfortunately, this only works "properly" for the first value in sheet1. For the other values it says they are filtered by, but no rows are returned and when I go back to sheet1 to select another value then click, it keeps the original filter. Thanks, Mark. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi Mark, This seems to work... Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean) Cancel = True Dim Selected Selected = ActiveCell.Value Sheets("Notes").Select Selection.AutoFilter Field:=1, Criteria1:=Selected, Operator:=xlAnd Ken Johnson |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Fantastic,
Works a treat Thanks for your help "Ken Johnson" wrote: Hi Mark, This seems to work... Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean) Cancel = True Dim Selected Selected = ActiveCell.Value Sheets("Notes").Select Selection.AutoFilter Field:=1, Criteria1:=Selected, Operator:=xlAnd Ken Johnson |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Mark,
You're welcome, thanks for the feedback. Ken Johnson |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Is this what you want?
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean) Dim Selected Set Selected = ActiveCell Sheets("Notes").Select Cells.AutoFilter Field:=Selected.Column, Criteria1:=ActiveCell.Value, Operator:=xlAnd End Sub -- HTH Bob Phillips (replace somewhere in email address with gmail if mailing direct) "Mark Stephenson" wrote in message ... Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean) Dim Selected Set Selected = ActiveCell Sheets("Notes").Select Selection.AutoFilter Field:=1, Criteria1:=ActiveCell.Value, Operator:=xlAnd End Sub When I right click a cell, it filters using the value from the cell. Unfortunately, this only works "properly" for the first value in sheet1. For the other values it says they are filtered by, but no rows are returned and when I go back to sheet1 to select another value then click, it keeps the original filter. Thanks, Mark. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Calculate working days but change working week | Excel Discussion (Misc queries) | |||
Making weekend days working days - the system cuts the working tim | Excel Discussion (Misc queries) | |||
macro was working, now it's not working | Excel Programming | |||
Macro working in Excel 2003; not working in Excel 2000 | Excel Programming | |||
Adding sales from a non working day to the previous working day | Excel Programming |