Hello All, I have attached a workbook with an example of my problem. If I select an employee name from the drop down, I need to list all other employees that are in the same location as the employee selected in the drop down, I need the employees names to be listed in the “P” column on sheet1. The emplyees and locations are listed on the employees sheet.
What would be my best approach to do this.
Thanks in advance.
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
-
Extract Associated data (2000/2003)
Home » Forums » AskWoody support » Productivity software by function » MS Excel and spreadsheet help » Extract Associated data (2000/2003)
- This topic has 34 replies, 3 voices, and was last updated 18 years, 2 months ago.
AuthorTopicWSstans
AskWoody LoungerMarch 31, 2007 at 2:02 pm #441181Viewing 1 reply threadAuthorReplies-
WSHansV
AskWoody Lounger -
WSstans
AskWoody Lounger -
WSHansV
AskWoody LoungerMarch 31, 2007 at 2:37 pm #1058705See attached version, it uses the Worksheet_Change event to run Advanced Filter with the Copy to another location option each time you select an employee in cell A3.
To do this, I changed the column header in column P to match that in column A, and set up a criteria range in G1:G2 on the Employees sheet. -
WSstans
AskWoody Lounger -
WSHansV
AskWoody LoungerMarch 31, 2007 at 3:23 pm #1058712To create the code, right-click the worksheet tab of Sheet1, and select View Code from the popup menu. This will open the worksheet module, and that’s where you create worksheet event code.
Blad1 is the Dutch name for Sheet1. Apparently Excel changed the code name for the sheet when I saved the workbook in my Dutch language version. You don’t have to do anything with it, you can stil use Sheet1 and Employees.
-
WSstans
AskWoody Lounger -
WSHansV
AskWoody Lounger -
WSstans
AskWoody Lounger -
WSHansV
AskWoody Lounger -
WSstans
AskWoody Lounger -
WSHansV
AskWoody Lounger -
WSstans
AskWoody Lounger -
WSHansV
AskWoody LoungerMarch 31, 2007 at 4:15 pm #1058722OK, that’s what I wanted to know. Unless that module contains other code already, the SaveFile macro should not be in there, but in a standard module, i.e. the kind of module you create by selecting Insert | Module in the Visual Basic Editor. The worksheet module should only be used for event procedures such as Worksheet_Change.
-
WSstans
AskWoody LoungerMarch 31, 2007 at 4:27 pm #1058723
-
-
-
-
WSHansV
AskWoody Lounger-
WSstans
AskWoody Lounger -
WSHansV
AskWoody LoungerMarch 31, 2007 at 5:06 pm #1058728In the Visual Basic Editor, click in the line
Private Sub Worksheet_Change(ByVal Target As Range)
Press F9. This will set a so-called breakpoint (you can remove it later on by clicking in the same line and pressing F9 again).
Switch to Excel, and select a different employee in the dropdown list in cell A3.
The Visual Basic Editor should be activated, with the above line highlighted in yellow.
You can step through the code by repeatedly pressing F8.
Does every line of the code get executed, or do you skip over lines? -
WSstans
AskWoody Lounger -
WSHansV
AskWoody Lounger -
WSstans
AskWoody Lounger -
WSHansV
AskWoody Lounger -
WSstans
AskWoody Lounger -
WSHansV
AskWoody Lounger -
WSstans
AskWoody Lounger -
WSHansV
AskWoody Lounger -
WSHansV
AskWoody LoungerMarch 31, 2007 at 8:05 pm #1058751There are two problems, one of which I should have seen in your screenshot.
1) The range to filter should include the column headers, so the filter instruction should have A1:O1159 instead of A2:O1159:
Worksheets(“Employees”).Range(“A1:O1159”).AdvancedFilter _
…2) The Extract to range should use the exact same column header as you want to extract from the data range. Since the employees’ names are in a column named Name, cell P1 on Sheet1 should also contain Name
With these two modifications, the code works correctly for me.
-
WSstans
AskWoody Lounger -
WSstans
AskWoody Lounger -
WSHansV
AskWoody LoungerApril 1, 2007 at 10:17 am #1058795Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Range(“N3”), Target) Is Nothing Then
Application.EnableEvents = False
Me.Unprotect
Worksheets(“Employees”).Range(“A1:O1159”).AdvancedFilter _
Action:=xlFilterCopy, _
CriteriaRange:=Worksheets(“Employees”).Range(“U1:U2”), _
CopyToRange:=Range(“P1”)
Me.Protect
Application.EnableEvents = True
End If
End Sub -
WSstans
AskWoody Lounger
-
-
Viewing 1 reply thread -

Plus Membership
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Get Plus!
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Search Newsletters
Search Forums
View the Forum
Search for Topics
Recent Topics
-
Install Office 365 Outlook classic on new Win11 machine (Awaiting moderation)
by
WSrcull999
21 minutes ago -
Install Office 365 Outlook classic on new Win11 machine (Awaiting moderation)
by
WSrcull999
29 minutes ago -
re-install Windows Security
by
CWBillow
1 hour, 3 minutes ago -
WWDC 2025 Recap: All of Apple’s NEW Features in 10 Minutes!
by
Alex5723
2 hours, 23 minutes ago -
macOS Tahoe 26
by
Alex5723
2 hours, 52 minutes ago -
Migrating from win10 to win11, instructions coming?
by
astro46
3 hours, 35 minutes ago -
Device Eligibility for Apple 2026 Operating Systems due this Fall
by
PKCano
3 hours, 9 minutes ago -
Recommended watching : Mountainhead movie
by
Alex5723
15 hours, 55 minutes ago -
End of support for Windows 10
by
Old enough to know better
1 hour, 17 minutes ago -
What goes on inside an LLM
by
Michael Covington
21 minutes ago -
The risk of remote access
by
Susan Bradley
6 hours ago -
The cruelest month for many Office users
by
Peter Deegan
12 hours, 33 minutes ago -
Tracking protection and trade-offs in Edge
by
Mary Branscombe
18 hours, 9 minutes ago -
Supreme Court grants DOGE access to confidential Social Security records
by
Alex5723
1 day ago -
EaseUS Partition Master free 19.6
by
Alex5723
1 hour, 24 minutes ago -
Microsoft : Edge is better than Chrome
by
Alex5723
1 day, 14 hours ago -
The EU launched DNS4EU
by
Alex5723
2 days, 2 hours ago -
Cell Phone vs. Traditional Touchtone Phone over POTS
by
280park
1 day, 17 hours ago -
Lost access to all my networked drives (shares) listed in My Computer
by
lwerman
2 days, 8 hours ago -
Set default size for pasted photo to word
by
Cyn
2 days, 14 hours ago -
Dedoimedo tries 24H2…
by
Cybertooth
2 days, 2 hours ago -
Windows 11 Insider Preview build 27871 released to Canary
by
joep517
3 days, 13 hours ago -
Windows 11 ad from Campaign Manager in Windows 10
by
Jim McKenna
1 day, 5 hours ago -
Small desktops
by
Susan Bradley
6 hours, 42 minutes ago -
Totally disable Bitlocker
by
CWBillow
2 days, 6 hours ago -
Phishers extract Millions from HMRC accounts..
by
Microfix
3 days, 10 hours ago -
Windows 10 22H2 Update today (5 June) says up-to-date but last was 2025-04
by
Alan_uk
4 days, 17 hours ago -
Thoughts on Malwarebytes Scam Guard for Mobile?
by
opti1
2 days, 11 hours ago -
Mystical Desktop
by
CWBillow
4 days, 20 hours ago -
Meta and Yandex secretly tracked billions of Android users
by
Alex5723
4 days, 1 hour ago
Recent blog posts
Key Links
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.