Solved

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

Posted on 2013-05-16
4
299 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 92

Accepted Solution

by:
Patrick Matthews earned 500 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:akoster
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Power Query Grouping By 2 23
Slicers by Groups in Excel 7 22
Array not populating all cells in Excel 6 23
Excel Formula 6 25
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

730 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