Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 28
Default Updating an Auto-Filter depending on cell value

I have created a workbook where I want any individual employee to select a
supervisor and on a seperate worksheet it will show everyone that reports to
that person. Currently I have linked the two sheets and the supervisor name
appears in cell B1 however I can't get my data (all emplopyees) to
auto-filter down to just that supervisor. Is there anyway to do this? I'm
thinking it may be a VBA since I can not get the auto-filter to change just
based on B1. thanks!
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 622
Default Updating an Auto-Filter depending on cell value

On Jan 9, 2:22*pm, JAbels001
wrote:
I have created a workbook where I want any individual employee to select a
supervisor and on a seperate worksheet it will show everyone that reports to
that person. Currently I have linked the two sheets and the supervisor name
appears in cell B1 however I can't get my data (all emplopyees) to
auto-filter down to just that supervisor. Is there anyway to do this? I'm
thinking it may be a VBA since I can not get the auto-filter to change just
based on B1. thanks!


If you need to change a source cell, use a macro on a button to re-run
the filter. Probably Advanced Filter would be better, this is what
it's designed to do. You can just record a simple macro like this,
then tweak if necessary.
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 28
Default Updating an Auto-Filter depending on cell value

Well the source cell (B1) is automatically being filled by the selection on
the previous worksheet so I wouldn't need that to happen. I need my actual
data to change to only that supervisor's agents. I.E.- I need the data below
c3 to change when B1 is fulfilled.

A B C
1 ='Pick Agent'A1
2
3 Agent Supervisor

"Spiky" wrote:

On Jan 9, 2:22 pm, JAbels001
wrote:
I have created a workbook where I want any individual employee to select a
supervisor and on a seperate worksheet it will show everyone that reports to
that person. Currently I have linked the two sheets and the supervisor name
appears in cell B1 however I can't get my data (all emplopyees) to
auto-filter down to just that supervisor. Is there anyway to do this? I'm
thinking it may be a VBA since I can not get the auto-filter to change just
based on B1. thanks!


If you need to change a source cell, use a macro on a button to re-run
the filter. Probably Advanced Filter would be better, this is what
it's designed to do. You can just record a simple macro like this,
then tweak if necessary.

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Updating an Auto-Filter depending on cell value

Not clear on how sheet2 is set up.

If you have in column B employee names and in column A their supervisor name
this should be easy to filter on a name entered in B1 on sheet1.

Sheet1 B1 has a Data Validation dropdown list with the supervisor's names.

Copy/paste the code below into the Sheet1 module. Right-click on the sheet
tab and "View Code" to open the module.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim WS2 As Worksheet
Dim WS1 As Worksheet
Dim rng As Range
Set WS1 = Sheets("Sheet1")
Set WS2 = Sheets("Sheet2")
Set rng = WS2.Range("A1:B" & Rows.Count)
If Target.Address = "$B$1" And Target.Value < "" Then
Application.EnableEvents = False

WS2.AutoFilterMode = False 'clears filter
rng.AutoFilter Field:=1, Criteria1:=WS1.Range("B1") 're-filters

End If
Application.EnableEvents = True
End Sub

Alt + q to return to the Excel window.

Select a supervisor from the dropdown in B1 to filter Sheet2


Gord Dibben MS Excel MVP

On Fri, 9 Jan 2009 12:22:18 -0800, JAbels001
wrote:

I have created a workbook where I want any individual employee to select a
supervisor and on a seperate worksheet it will show everyone that reports to
that person. Currently I have linked the two sheets and the supervisor name
appears in cell B1 however I can't get my data (all emplopyees) to
auto-filter down to just that supervisor. Is there anyway to do this? I'm
thinking it may be a VBA since I can not get the auto-filter to change just
based on B1. thanks!


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 28
Default Updating an Auto-Filter depending on cell value

Gord,

thanks for the help... I had to change a couple of things b/c I had the
values in different places, but it worked like a charm! thanks again!

"Gord Dibben" wrote:

Not clear on how sheet2 is set up.

If you have in column B employee names and in column A their supervisor name
this should be easy to filter on a name entered in B1 on sheet1.

Sheet1 B1 has a Data Validation dropdown list with the supervisor's names.

Copy/paste the code below into the Sheet1 module. Right-click on the sheet
tab and "View Code" to open the module.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim WS2 As Worksheet
Dim WS1 As Worksheet
Dim rng As Range
Set WS1 = Sheets("Sheet1")
Set WS2 = Sheets("Sheet2")
Set rng = WS2.Range("A1:B" & Rows.Count)
If Target.Address = "$B$1" And Target.Value < "" Then
Application.EnableEvents = False

WS2.AutoFilterMode = False 'clears filter
rng.AutoFilter Field:=1, Criteria1:=WS1.Range("B1") 're-filters

End If
Application.EnableEvents = True
End Sub

Alt + q to return to the Excel window.

Select a supervisor from the dropdown in B1 to filter Sheet2


Gord Dibben MS Excel MVP

On Fri, 9 Jan 2009 12:22:18 -0800, JAbels001
wrote:

I have created a workbook where I want any individual employee to select a
supervisor and on a seperate worksheet it will show everyone that reports to
that person. Currently I have linked the two sheets and the supervisor name
appears in cell B1 however I can't get my data (all emplopyees) to
auto-filter down to just that supervisor. Is there anyway to do this? I'm
thinking it may be a VBA since I can not get the auto-filter to change just
based on B1. thanks!





  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 22,906
Default Updating an Auto-Filter depending on cell value

Good to hear.


Gord

On Fri, 9 Jan 2009 13:48:19 -0800, JAbels001
wrote:

Gord,

thanks for the help... I had to change a couple of things b/c I had the
values in different places, but it worked like a charm! thanks again!

"Gord Dibben" wrote:

Not clear on how sheet2 is set up.

If you have in column B employee names and in column A their supervisor name
this should be easy to filter on a name entered in B1 on sheet1.

Sheet1 B1 has a Data Validation dropdown list with the supervisor's names.

Copy/paste the code below into the Sheet1 module. Right-click on the sheet
tab and "View Code" to open the module.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim WS2 As Worksheet
Dim WS1 As Worksheet
Dim rng As Range
Set WS1 = Sheets("Sheet1")
Set WS2 = Sheets("Sheet2")
Set rng = WS2.Range("A1:B" & Rows.Count)
If Target.Address = "$B$1" And Target.Value < "" Then
Application.EnableEvents = False

WS2.AutoFilterMode = False 'clears filter
rng.AutoFilter Field:=1, Criteria1:=WS1.Range("B1") 're-filters

End If
Application.EnableEvents = True
End Sub

Alt + q to return to the Excel window.

Select a supervisor from the dropdown in B1 to filter Sheet2


Gord Dibben MS Excel MVP

On Fri, 9 Jan 2009 12:22:18 -0800, JAbels001
wrote:

I have created a workbook where I want any individual employee to select a
supervisor and on a seperate worksheet it will show everyone that reports to
that person. Currently I have linked the two sheets and the supervisor name
appears in cell B1 however I can't get my data (all emplopyees) to
auto-filter down to just that supervisor. Is there anyway to do this? I'm
thinking it may be a VBA since I can not get the auto-filter to change just
based on B1. thanks!




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
[Q] Auto filter possible on multi-value cell? John IV Excel Worksheet Functions 1 June 20th 06 07:59 AM
Cell formula not updating, auto calc on, over 100 sheets mcphc Excel Discussion (Misc queries) 1 June 15th 06 04:03 PM
Cell protection & Auto Filter fastballfreddy Excel Worksheet Functions 1 May 11th 06 11:51 AM
Cell showing the time auto updating M. Neves Excel Discussion (Misc queries) 3 February 23rd 06 01:30 PM
Auto fill multiple cells depending on single cell value henrat Excel Worksheet Functions 2 November 28th 05 04:59 AM


All times are GMT +1. The time now is 08:39 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"