Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #7  
Old 06-10-2015, 12:11 PM
charlesdh charlesdh is offline Setting autofilter criteria using columns and cells relative to the active cell in another sheet Windows 7 32bit Setting autofilter criteria using columns and cells relative to the active cell in another sheet Office 2010 32bit
Expert
 
Join Date: Apr 2014
Location: Mississippi
Posts: 382
charlesdh is on a distinguished road
Default

Hi,

Here's a code that may work. However, it currently looks at "April" and "Accounting" only.
You mentioned "Value = 37" I do not know what you mean by that.
Copy and paste this code to the sheet module for "Overhead".

Code:
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
''Name variables
Dim MyMth As String
Dim MyYr As String
Dim MyCtr As String
Dim TDws As Worksheet
Dim OAws As Worksheet
Set TDws = Sheets("TranDetail")
Set OAws = Sheets("Overhead Analysis")
'''check to see if user clicks with in column "A"''
'' if not exit sub ''
If Intersect(Target, Range("A3:a23")) Is Nothing Then
    Exit Sub
Else
''' we set the filter for  TranDetail then ''''
''' activate TranDetail sheet'''
    MyMth = Month(OAws.Range("C5"))
    MyYr = Year(OAws.Range("C5"))
    MyCtr = OAws.Range("A" & ActiveCell.Row)
    ''' Activate TranDetail and set filter '''
    TDws.Activate
    On Error Resume Next '' check for filter if there goto next line of code''
    Selection.AutoFilter
    TDws.Range("A5:G5").Select '' we selected the range for the filter
    With Selection
        .AutoFilter Field:=2, Criteria1:=MyMth
        .AutoFilter Field:=3, Criteria1:=MyYr
        .AutoFilter Field:=5, Criteria1:=MyCtr
    End With
    
End If
End Sub
Reply With Quote
 

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting autofilter criteria using columns and cells relative to the active cell in another sheet Create a New Sheet from Existing Sheet with Specific Columns malam Excel Programming 1 10-17-2014 10:01 PM
Matching Criteria against a range when criteria is not in contiguous cells?? GMorris Excel 9 08-20-2014 02:15 AM
Autofilter on two Date Columns OTPM Excel Programming 3 04-29-2014 12:56 AM
Setting autofilter criteria using columns and cells relative to the active cell in another sheet From an XL sheet ,how to keep the group of columns which match with other XL sheet Zubairkhan Excel 2 03-04-2014 10:57 PM
Setting autofilter criteria using columns and cells relative to the active cell in another sheet How to merge two cells from sheet1 to one cell in sheet2 in next sheet KIM SOLIS Excel 6 10-30-2011 11:14 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:17 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft