• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Double click event how it works

Bhawani

Member
Dear All,

I googled for this but not helped me as much, actually i want to run a macro on double clicking with below requirements.
on double clicking on cells current region row header and column header should be get somewhere on sheet which will i use to further advancefilter in same sheet.

sheets is attached
 

Attachments

  • My Query.xlsm
    17.7 KB · Views: 1
I wouldn't use the Double click event, I would use the Selection_Change event
as per below

Copy this code into the Code Module for the Summary Worksheet
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Intersect(Target, Range("D6:G8")) Is Nothing Then Exit Sub
Range("I2") = Cells(Target.Row, 3)
Range("J2") = Cells(5, Target.Column)

Application.EnableEvents = False

Call Run_ADV_Filter

Application.EnableEvents = True

End Sub

I would also add the Worksheet Names to the Advance Filter code

Code:
Sub Run_ADV_Filter()

  Range("I2").Select
  Sheets("Data").Range("A1:F1000").AdvancedFilter Action:=xlFilterCopy, _
  CriteriaRange:=Sheets("Summary").Range("I1:J2"), _
  CopyToRange:=Sheets("Summary").Range("A11:F11"), _
  Unique:=False
End Sub

or see the attached file
 

Attachments

  • My Query.xlsm
    19.2 KB · Views: 1
Thanks hui sir,
for your kind revert it will help alot & can it be done in several table in summary reports
 
Dear Sir,

Above suggest i have implemented but summary table includes column header with sub header like in attached; also
i don't want to display all but few on which my seniors would be interested at the time of presenting data in monthly meeting.
it is not urgent but very important for me and so would like to go with double click at questioning of my seniors.
Concern : why i am getting "Done : same as last" while intersecting from D6:D8
 

Attachments

  • My Query V1.1.xlsm
    20.3 KB · Views: 0
You shifted the ranges but didn't change the VBA Code in the Summary code module to reflect the changes

Double clicking in Excel is the same as Editing (F2) and I don't want to effect that functionality
You can modify the code if you wish.
 

Attachments

  • My Query V1.1.xlsm
    20.6 KB · Views: 0
Back
Top