Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2013-05-16
4
Medium Priority
?
310 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
With its various features, Office 365 can not only help you with your day-to-day business tasks, it can also do wonders for your marketing campaign.
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

618 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