Hi all,
I'm hoping you can assist me. On my worksheet ("MAIN") I have two tables. One table is "EmployeeList" and the other table is "AccountHolders". The "EmployeeList" is a frequently updated table, while the "AccountHolders" table is one that only updates when the "UPDATE BUTTON" (actual Form Control button in my real file) is clicked. What I'm trying to get VBA to do is:
Once the "UPDATE" button is clicked, it should clear out the "Name" column in the "AccountHolders" table. Then I need it to go row by row in the "EmployeeList" list table, looking to see if there's a string/value in the "Largest Account" column. If there is a value in the column of that row, I want it to copy the "Name" from that row in the "EmployeeList" table and paste it into the next available row in the "Name" column of the "AccountHolders" table - and then proceed to the next row in the "EmployeeList" table that has a value in the "Largest Account" column, and do the same (copy that row's "Name" into the next available row of the "Name" column of "AccountHolders", and so on...
I've included below an example of what I have and what the desired output would be. Any assistance would be greatly appreciated!
I'm hoping you can assist me. On my worksheet ("MAIN") I have two tables. One table is "EmployeeList" and the other table is "AccountHolders". The "EmployeeList" is a frequently updated table, while the "AccountHolders" table is one that only updates when the "UPDATE BUTTON" (actual Form Control button in my real file) is clicked. What I'm trying to get VBA to do is:
Once the "UPDATE" button is clicked, it should clear out the "Name" column in the "AccountHolders" table. Then I need it to go row by row in the "EmployeeList" list table, looking to see if there's a string/value in the "Largest Account" column. If there is a value in the column of that row, I want it to copy the "Name" from that row in the "EmployeeList" table and paste it into the next available row in the "Name" column of the "AccountHolders" table - and then proceed to the next row in the "EmployeeList" table that has a value in the "Largest Account" column, and do the same (copy that row's "Name" into the next available row of the "Name" column of "AccountHolders", and so on...
I've included below an example of what I have and what the desired output would be. Any assistance would be greatly appreciated!
Book2 | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | G | H | I | J | |||
1 | UPDATE BUTTON | |||||||||||
2 | Table Name = "AccountHolders" | Table Name = "EmployeeList" | ||||||||||
3 | Name | City | Years Active | Phone Number | Name | Company | City | Largest Account | Date Account Acquired | |||
4 | Johnathan L | Davidson | Chicago | ABC Corporate | 1/22/2020 | |||||||
5 | Marcus J | Ruby Pharm. | Dallas | Louiseville C&N | 2/1/2020 | |||||||
6 | Louise S | J & J | New York | |||||||||
7 | Freddy M | Twos | Akron | |||||||||
8 | Todd S | Bridgewater | Miami | United Cargo | 5/29/2020 | |||||||
9 | Jennifer H | Softsquare | Phoenix | |||||||||
10 | Hugh G | Green Park | Austin | Phoenix Logistics | 4/16/2019 | |||||||
11 | Parker L. | ALC Pharm | Los Angeles | |||||||||
12 | ||||||||||||
13 | ||||||||||||
14 | ||||||||||||
15 | DESIRED OUTPUT AFTER CLICKING "UPDATE" BUTTON | |||||||||||
16 | Table Name = "AccountHolders" | Table Name = "EmployeeList" | ||||||||||
17 | Name | City | Years Active | Phone Number | Name | Company | City | Largest Account | Date Account Acquired | |||
18 | Johnathan L | Johnathan L | Davidson | Chicago | ABC Corporate | 1/22/2020 | ||||||
19 | Marcus J | Marcus J | Ruby Pharm. | Dallas | Louiseville C&N | 2/1/2020 | ||||||
20 | Todd S | Louise S | J & J | New York | ||||||||
21 | Hugh G | Freddy M | Twos | Akron | ||||||||
22 | Todd S | Bridgewater | Miami | United Cargo | 5/29/2020 | |||||||
23 | Jennifer H | Softsquare | Phoenix | |||||||||
24 | Hugh G | Green Park | Austin | Phoenix Logistics | 4/16/2019 | |||||||
25 | Parker L. | ALC Pharm | Los Angeles | |||||||||
Sheet1 |