Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Almost working using...

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,073
Default Almost working using...


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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Almost working using...

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,073
Default Almost working using...

Hi Mark,

You're welcome, thanks for the feedback.

Ken Johnson

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Almost working using...

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
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
Calculate working days but change working week SamB Excel Discussion (Misc queries) 1 September 1st 08 09:17 PM
Making weekend days working days - the system cuts the working tim Fluffy Excel Discussion (Misc queries) 1 May 30th 08 10:02 PM
macro was working, now it's not working RichardO[_11_] Excel Programming 2 June 9th 04 06:27 AM
Macro working in Excel 2003; not working in Excel 2000 Leslie Barberie Excel Programming 5 May 20th 04 07:51 PM
Adding sales from a non working day to the previous working day Alex Excel Programming 1 September 19th 03 08:48 AM


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