?
Solved

Loop through each filter value and add matching row values to an array

Posted on 2013-05-16
4
Medium Priority
?
306 Views
Last Modified: 2014-05-23
Hi Everyone,

I have a spreadsheet that has 2 columns (with headers). The columns are Branch and DisplayName. Right now there are about 700 total rows in my spreadsheet. What I'm trying to accomplish here is to create Outlook e-mails populated with display names in to the TO field based on each distinct Branch value. There are about 15 different branch values when you look at the filter dropdown in excel. In this case, the VBA would generate 15 different e-mails with the display names of each person in their respective branch populated in the TO field.

I have the VBA code to create and populate e-mails created. I just have no clue how to loop through each distinct value of the filter and retrieve the respective matching rows for each distinct value.

Thanks for your help!
0
Comment
Question by:26fconsulting
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 93

Accepted Solution

by:
Patrick Matthews earned 2000 total points
ID: 39171712
As far as I know, there is no direct way to access the filter items.

What I would do is use a "Dictionary of Dictionaries" to find the unique items.  The "parent" Dictionary would have a key for each branch, and the item would be child Dictionary containing the unique display names for that branch.

When generating the emails, , loop through the parent Dictionary to generate the emails, and then use the keys from the child Dictionary to populate the "To" field.

If you need more help than this, a sample file would be useful.
0
 
LVL 19

Expert Comment

by:Arno Koster
ID: 39222450
elsewise you could implement a pivot table to get the distinct branch values and use the rows of the pivot table to generate the emails, then use columns of the pivot table (the displaynames) to populate each email.

An educated guess would be that following matthewspatrick's advise will be the better approach for you though.
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
I was prompted to write this article after the recent World-Wide Ransomware outbreak. For years now, System Administrators around the world have used the excuse of "Waiting a Bit" before applying Security Patch Updates. This type of reasoning to me …
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question