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.
![]() |
There are isolated problems with current patches, but they are well-known and documented on this site. |
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 -
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
-
Office gets current release
by
Susan Bradley
31 minutes ago -
FBI: Still Using One of These Old Routers? It’s Vulnerable to Hackers
by
Alex5723
2 hours, 9 minutes ago -
Windows AI Local Only no NPU required!
by
RetiredGeek
1 hour, 4 minutes ago -
Stop the OneDrive defaults
by
CWBillow
2 hours, 57 minutes ago -
Windows 11 Insider Preview build 27868 released to Canary
by
joep517
12 hours, 53 minutes ago -
X Suspends Encrypted DMs
by
Alex5723
15 hours, 5 minutes ago -
WSJ : My Robot and Me AI generated movie
by
Alex5723
15 hours, 23 minutes ago -
Botnet hacks 9,000+ ASUS routers to add persistent SSH backdoor
by
Alex5723
16 hours ago -
OpenAI model sabotages shutdown code
by
Cybertooth
16 hours, 37 minutes ago -
Backup and access old e-mails after company e-mail address is terminated
by
M W Leijendekker
4 hours, 47 minutes ago -
Enabling Secureboot
by
ITguy
11 hours, 47 minutes ago -
Windows hosting exposes additional bugs
by
Susan Bradley
1 day ago -
No more rounded corners??
by
CWBillow
20 hours, 20 minutes ago -
Android 15 and IPV6
by
Win7and10
10 hours, 5 minutes ago -
KB5058405 might fail to install with recovery error 0xc0000098 in ACPI.sys
by
Susan Bradley
1 day, 12 hours ago -
T-Mobile’s T-Life App has a “Screen Recording Tool” Turned on
by
Alex5723
1 day, 15 hours ago -
Windows 11 Insider Preview Build 26100.4202 (24H2) released to Release Preview
by
joep517
1 day, 10 hours ago -
Windows Update orchestration platform to update all software
by
Alex5723
1 day, 22 hours ago -
May preview updates
by
Susan Bradley
1 day, 10 hours ago -
Microsoft releases KB5061977 Windows 11 24H2, Server 2025 emergency out of band
by
Alex5723
1 day, 1 hour ago -
Just got this pop-up page while browsing
by
Alex5723
1 day, 15 hours ago -
KB5058379 / KB 5061768 Failures
by
crown
1 day, 12 hours ago -
Windows 10 23H2 Good to Update to ?
by
jkitc
14 hours, 20 minutes ago -
At last – installation of 24H2
by
Botswana12
2 days, 14 hours ago -
MS-DEFCON 4: As good as it gets
by
Susan Bradley
11 hours, 7 minutes ago -
RyTuneX optimize Windows 10/11 tool
by
Alex5723
3 days, 2 hours ago -
Can I just update from Win11 22H2 to 23H2?
by
Dave Easley
1 day, 1 hour ago -
Limited account permission error related to Windows Update
by
gtd12345
3 days, 15 hours ago -
Another test post
by
gtd12345
3 days, 16 hours ago -
Connect to someone else computer
by
wadeer
3 days, 10 hours 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.