Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 75
Default sort by name when user selects name on another worksheet

Is there any want to select a value on one worksheet, using a pick list, and
having that sort data by the name on another sheet? For example in a sheet
named €śStart Here€ť Cell B3 has a pick list with names in it, like Joe, bill,
bob, henry etc. If the user selects Joe on that worksheet, then another
worksheet named €śEmployees Info 2-25-10€ť is sorted by that name, i.e. Joe?
Is this possible, if so how? Any help would be appreciated!
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,203
Default sort by name when user selects name on another worksheet

I think that you mean data filtered rather than sorted? In other words, when
you select "Joe" on the Start Here sheet, then the Employees Info sheet will
only display entries with Joe in a particular column?

If so, here's how to go about getting this done. First, to keep from
constantly filtering the "Employees Info..." sheet each time someone picks a
new name in B3, I'd have the "Employees Info..." sheet react when it is
selected.

Start by recording a new macro while you go through the process of filtering
the data on the "Employees Info..." sheet by any name in the list. You will
use the code it generates as the basis for your automation action.

It may record something that looks like this:
Sub Macro1()
Range("A1").Select
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="Joe"
End Sub

Now go to the "Employee Info..." sheet, right-click on it's name tab and
choose [View Code]. Copy the code here and paste it into the module
presented to you:

Private Sub Worksheet_Activate()

End Sub

Now go get the code from inside of the Sub Macro1() routine and copy it and
paste it in between the 2 lines of code above, so that you have something
that looks like

Private Sub Worksheet_Activate()
Range("A1").Select
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="Joe"
End Sub

Now all you have to do is change the "Joe" to reference B3 on the Start here
sheet, so that the code ends up looking something like:
Private Sub Worksheet_Activate()
Range("A1").Select
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:= _
ThisWorkbook.Worksheets("Start Here").Range("B3")
End Sub


"Mathew" wrote:

Is there any want to select a value on one worksheet, using a pick list, and
having that sort data by the name on another sheet? For example in a sheet
named €śStart Here€ť Cell B3 has a pick list with names in it, like Joe, bill,
bob, henry etc. If the user selects Joe on that worksheet, then another
worksheet named €śEmployees Info 2-25-10€ť is sorted by that name, i.e. Joe?
Is this possible, if so how? Any help would be appreciated!

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 75
Default sort by name when user selects name on another worksheet

JLatham: Very insightful and dead on correct. I did mean sort, in my
question, and your help solved the problem! Thank you!
"JLatham" wrote:

I think that you mean data filtered rather than sorted? In other words, when
you select "Joe" on the Start Here sheet, then the Employees Info sheet will
only display entries with Joe in a particular column?

If so, here's how to go about getting this done. First, to keep from
constantly filtering the "Employees Info..." sheet each time someone picks a
new name in B3, I'd have the "Employees Info..." sheet react when it is
selected.

Start by recording a new macro while you go through the process of filtering
the data on the "Employees Info..." sheet by any name in the list. You will
use the code it generates as the basis for your automation action.

It may record something that looks like this:
Sub Macro1()
Range("A1").Select
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="Joe"
End Sub

Now go to the "Employee Info..." sheet, right-click on it's name tab and
choose [View Code]. Copy the code here and paste it into the module
presented to you:

Private Sub Worksheet_Activate()

End Sub

Now go get the code from inside of the Sub Macro1() routine and copy it and
paste it in between the 2 lines of code above, so that you have something
that looks like

Private Sub Worksheet_Activate()
Range("A1").Select
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:="Joe"
End Sub

Now all you have to do is change the "Joe" to reference B3 on the Start here
sheet, so that the code ends up looking something like:
Private Sub Worksheet_Activate()
Range("A1").Select
Selection.AutoFilter
Selection.AutoFilter Field:=1, Criteria1:= _
ThisWorkbook.Worksheets("Start Here").Range("B3")
End Sub


"Mathew" wrote:

Is there any want to select a value on one worksheet, using a pick list, and
having that sort data by the name on another sheet? For example in a sheet
named €śStart Here€ť Cell B3 has a pick list with names in it, like Joe, bill,
bob, henry etc. If the user selects Joe on that worksheet, then another
worksheet named €śEmployees Info 2-25-10€ť is sorted by that name, i.e. Joe?
Is this possible, if so how? Any help would be appreciated!

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
Need an input box when user selects a value in a drop down box Susan Excel Worksheet Functions 4 September 8th 08 06:14 PM
Start Macro after user selects a choice from a pick list mathew Excel Discussion (Misc queries) 2 August 17th 06 03:28 PM
Protect worksheet and still allow user to sort data J9 Excel Worksheet Functions 3 July 24th 06 02:08 AM
Sort Without User Input guilbj2 Excel Discussion (Misc queries) 2 May 12th 06 03:22 AM
Password visible if user selects "view code" kcdonaldson Excel Worksheet Functions 2 December 3rd 05 03:48 PM


All times are GMT +1. The time now is 09:45 AM.

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"