Hello,
In the excel file that I am using I have 3 worksheets and I will explain their purpose below:
1. Before Macro – This worksheet represents the actual data that I will be importing into excel from an external data source
<table style="width: 785px; height: 210px;" border="0" cellpadding="0" cellspacing="0"><col style="mso-width-source:userset;mso-width-alt:2787;width:59pt" width="78"> <col style="mso-width-source:userset;mso-width-alt:2759;width:58pt" width="78"> <col style="mso-width-source:userset;mso-width-alt:1507;width:32pt" width="42"> <col style="mso-width-source:userset;mso-width-alt:1223;width:26pt" width="34"> <col style="mso-width-source:userset;mso-width-alt:1792;width:38pt" width="50"> <col style="mso-width-source:userset;mso-width-alt:2218;width:47pt" width="62"> <col style="mso-width-source:userset;mso-width-alt:1962;width:41pt" width="55"> <col style="width:48pt" width="64"> <tbody><tr style="height:14.4pt" height="19"> <td class="xl71" style="height:14.4pt;width:59pt" width="78" height="19">Report Date</td> <td class="xl66" style="border-left:none;width:58pt" width="78">EmployeeID</td> <td class="xl72" style="border-left:none;width:32pt" width="42">Name</td> <td class="xl66" style="border-left:none;width:26pt" width="34">BW</td> <td class="xl66" style="border-left:none;width:38pt" width="50">Class</td> <td class="xl66" style="border-left:none;width:47pt" width="62">Make</td> <td class="xl66" style="border-left:none;width:41pt" width="55">Function</td> <td class="xl67" style="border-left:none;width:48pt" width="64">Hours</td> </tr> <tr style="height:14.4pt" height="19"> <td class="xl73" style="height:14.4pt;border-top:none" height="19">6/9/2011</td> <td class="xl65" style="border-top:none;border-left:none">1</td> <td class="xl65" style="border-top:none;border-left:none">Mike</td> <td class="xl65" style="border-top:none;border-left:none">3</td> <td class="xl65" style="border-top:none;border-left:none"> </td> <td class="xl65" style="border-top:none;border-left:none"> </td> <td class="xl65" style="border-top:none;border-left:none"> </td> <td class="xl65" style="border-top:none;border-left:none">2</td> </tr> <tr style="height:14.4pt" height="19"> <td class="xl73" style="height:14.4pt;border-top:none" height="19">6/9/2011</td> <td class="xl65" style="border-top:none;border-left:none">2</td> <td class="xl65" style="border-top:none;border-left:none">Tim</td> <td class="xl65" style="border-top:none;border-left:none">1</td> <td class="xl65" style="border-top:none;border-left:none"> </td> <td class="xl65" style="border-top:none;border-left:none"> </td> <td class="xl65" style="border-top:none;border-left:none"> </td> <td class="xl65" style="border-top:none;border-left:none">4</td> </tr> <tr style="height:14.4pt" height="19"> <td class="xl73" style="height:14.4pt;border-top:none" height="19">6/9/2011</td> <td class="xl65" style="border-top:none;border-left:none">3</td> <td class="xl65" style="border-top:none;border-left:none">Jen</td> <td class="xl65" style="border-top:none;border-left:none">5</td> <td class="xl65" style="border-top:none;border-left:none"> </td> <td class="xl65" style="border-top:none;border-left:none"> </td> <td class="xl65" style="border-top:none;border-left:none"> </td> <td class="xl65" style="border-top:none;border-left:none">5</td> </tr> <tr style="height:14.4pt" height="19"> <td class="xl73" style="height:14.4pt;border-top:none" height="19">6/9/2011</td> <td class="xl65" style="border-top:none;border-left:none">4</td> <td class="xl65" style="border-top:none;border-left:none">Ben</td> <td class="xl65" style="border-top:none;border-left:none">3</td> <td class="xl65" style="border-top:none;border-left:none"> </td> <td class="xl65" style="border-top:none;border-left:none"> </td> <td class="xl65" style="border-top:none;border-left:none"> </td> <td class="xl65" style="border-top:none;border-left:none">9</td> </tr> <tr style="height:14.4pt" height="19"> <td class="xl73" style="height:14.4pt;border-top:none" height="19">6/9/2011</td> <td class="xl65" style="border-top:none;border-left:none">1</td> <td class="xl65" style="border-top:none;border-left:none">Mike</td> <td class="xl65" style="border-top:none;border-left:none">1</td> <td class="xl65" style="border-top:none;border-left:none"> </td> <td class="xl65" style="border-top:none;border-left:none"> </td> <td class="xl65" style="border-top:none;border-left:none"> </td> <td class="xl65" style="border-top:none;border-left:none">1</td> </tr> <tr style="height:14.4pt" height="19"> <td class="xl73" style="height:14.4pt;border-top:none" height="19">6/9/2011</td> <td class="xl65" style="border-top:none;border-left:none">5</td> <td class="xl65" style="border-top:none;border-left:none">Scott</td> <td class="xl65" style="border-top:none;border-left:none">4</td> <td class="xl65" style="border-top:none;border-left:none"> </td> <td class="xl65" style="border-top:none;border-left:none"> </td> <td class="xl65" style="border-top:none;border-left:none"> </td> <td class="xl65" style="border-top:none;border-left:none">6</td> </tr> <tr style="height:14.4pt" height="19"> <td class="xl73" style="height:14.4pt;border-top:none" height="19">6/9/2011</td> <td class="xl65" style="border-top:none;border-left:none">1</td> <td class="xl65" style="border-top:none;border-left:none">Mike</td> <td class="xl65" style="border-top:none;border-left:none">3</td> <td class="xl65" style="border-top:none;border-left:none"> </td> <td class="xl65" style="border-top:none;border-left:none"> </td> <td class="xl65" style="border-top:none;border-left:none"> </td> <td class="xl65" style="border-top:none;border-left:none">7</td> </tr> <tr style="height:14.4pt" height="19"> <td class="xl73" style="height:14.4pt;border-top:none" height="19">6/9/2011</td> <td class="xl65" style="border-top:none;border-left:none">2</td> <td class="xl65" style="border-top:none;border-left:none">Tim</td> <td class="xl65" style="border-top:none;border-left:none">1</td> <td class="xl65" style="border-top:none;border-left:none"> </td> <td class="xl65" style="border-top:none;border-left:none"> </td> <td class="xl65" style="border-top:none;border-left:none"> </td> <td class="xl65" style="border-top:none;border-left:none">8</td> </tr> </tbody></table>
2. After Macro – This worksheet shows what the data will look like after I run the macro
<table style="width: 792px; height: 273px;" border="0" cellpadding="0" cellspacing="0"><col style="mso-width-source:userset;mso-width-alt:2787;width:59pt" width="78"> <col style="mso-width-source:userset;mso-width-alt:2759;width:58pt" width="78"> <col style="mso-width-source:userset;mso-width-alt:1507;width:32pt" width="42"> <col style="mso-width-source:userset;mso-width-alt:1223;width:26pt" width="34"> <col style="mso-width-source:userset;mso-width-alt:1792;width:38pt" width="50"> <col style="mso-width-source:userset;mso-width-alt:1422;width:30pt" width="40"> <col style="mso-width-source:userset;mso-width-alt:3982;width:84pt" width="112"> <col style="mso-width-source:userset;mso-width-alt:1479;width:31pt" width="42"> <tbody><tr style="height:14.4pt" height="19"> <td class="xl71" style="height:14.4pt;width:59pt" width="78" height="19">Report Date</td> <td class="xl66" style="border-left:none;width:58pt" width="78">EmployeeID</td> <td class="xl72" style="border-left:none;width:32pt" width="42">Name</td> <td class="xl66" style="border-left:none;width:26pt" width="34">BW</td> <td class="xl66" style="border-left:none;width:38pt" width="50">Class</td> <td class="xl66" style="border-left:none;width:30pt" width="40">Make</td> <td class="xl66" style="border-left:none;width:84pt" width="112">Function</td> <td class="xl67" style="border-left:none;width:31pt" width="42">Hours</td> </tr> <tr style="height:14.4pt" height="19"> <td class="xl73" style="height:14.4pt;border-top:none" height="19">6/9/2011</td> <td class="xl65" style="border-top:none;border-left:none">1</td> <td class="xl65" style="border-top:none;border-left:none">Mike</td> <td class="xl65" style="border-top:none;border-left:none">3</td> <td class="xl65" style="border-top:none;border-left:none">NC 9</td> <td class="xl65" style="border-top:none;border-left:none">NC 9</td> <td class="xl65" style="border-top:none;border-left:none">Quality Assurance</td> <td class="xl65" style="border-top:none;border-left:none">2</td> </tr> <tr style="height:14.4pt" height="19"> <td class="xl73" style="height:14.4pt;border-top:none" height="19">6/9/2011</td> <td class="xl65" style="border-top:none;border-left:none">2</td> <td class="xl65" style="border-top:none;border-left:none">Tim</td> <td class="xl65" style="border-top:none;border-left:none">1</td> <td class="xl65" style="border-top:none;border-left:none">NC 1</td> <td class="xl65" style="border-top:none;border-left:none">NC 1</td> <td class="xl65" style="border-top:none;border-left:none">Finance</td> <td class="xl65" style="border-top:none;border-left:none">4</td> </tr> <tr style="height:14.4pt" height="19"> <td class="xl73" style="height:14.4pt;border-top:none" height="19">6/9/2011</td> <td class="xl65" style="border-top:none;border-left:none">3</td> <td class="xl65" style="border-top:none;border-left:none">Jen</td> <td class="xl65" style="border-top:none;border-left:none">5</td> <td class="xl65" style="border-top:none;border-left:none">NS 7</td> <td class="xl65" style="border-top:none;border-left:none">NS 7</td> <td class="xl65" style="border-top:none;border-left:none">Accounting</td> <td class="xl65" style="border-top:none;border-left:none">5</td> </tr> <tr style="height:14.4pt" height="19"> <td class="xl73" style="height:14.4pt;border-top:none" height="19">6/9/2011</td> <td class="xl65" style="border-top:none;border-left:none">4</td> <td class="xl65" style="border-top:none;border-left:none">Ben</td> <td class="xl65" style="border-top:none;border-left:none">3</td> <td class="xl65" style="border-top:none;border-left:none">NC 9</td> <td class="xl65" style="border-top:none;border-left:none">NC 9</td> <td class="xl65" style="border-top:none;border-left:none">Quality Assurance</td> <td class="xl65" style="border-top:none;border-left:none">9</td> </tr> <tr style="height:14.4pt" height="19"> <td class="xl73" style="height:14.4pt;border-top:none" height="19">6/9/2011</td> <td class="xl65" style="border-top:none;border-left:none">1</td> <td class="xl65" style="border-top:none;border-left:none">Mike</td> <td class="xl65" style="border-top:none;border-left:none">1</td> <td class="xl65" style="border-top:none;border-left:none">NC 1</td> <td class="xl65" style="border-top:none;border-left:none">NC 1</td> <td class="xl65" style="border-top:none;border-left:none">Finance</td> <td class="xl65" style="border-top:none;border-left:none">1</td> </tr> <tr style="height:14.4pt" height="19"> <td class="xl73" style="height:14.4pt;border-top:none" height="19">6/9/2011</td> <td class="xl65" style="border-top:none;border-left:none">5</td> <td class="xl65" style="border-top:none;border-left:none">Scott</td> <td class="xl65" style="border-top:none;border-left:none">4</td> <td class="xl65" style="border-top:none;border-left:none">NS 4</td> <td class="xl65" style="border-top:none;border-left:none">NS 4</td> <td class="xl65" style="border-top:none;border-left:none">Engineering</td> <td class="xl65" style="border-top:none;border-left:none">6</td> </tr> <tr style="height:14.4pt" height="19"> <td class="xl73" style="height:14.4pt;border-top:none" height="19">6/9/2011</td> <td class="xl65" style="border-top:none;border-left:none">1</td> <td class="xl65" style="border-top:none;border-left:none">Mike</td> <td class="xl65" style="border-top:none;border-left:none">3</td> <td class="xl65" style="border-top:none;border-left:none">NC 9</td> <td class="xl65" style="border-top:none;border-left:none">NC 9</td> <td class="xl65" style="border-top:none;border-left:none">Quality Assurance</td> <td class="xl65" style="border-top:none;border-left:none">7</td> </tr> <tr style="height:14.4pt" height="19"> <td class="xl73" style="height:14.4pt;border-top:none" height="19">6/9/2011</td> <td class="xl65" style="border-top:none;border-left:none">2</td> <td class="xl65" style="border-top:none;border-left:none">Tim</td> <td class="xl65" style="border-top:none;border-left:none">1</td> <td class="xl65" style="border-top:none;border-left:none">NC 1</td> <td class="xl65" style="border-top:none;border-left:none">NC 1</td> <td class="xl65" style="border-top:none;border-left:none">Finance</td> <td class="xl65" style="border-top:none;border-left:none">8</td> </tr> </tbody></table>
3. DataList – This worksheet contains a list of items that the macro will use (I ACTUALLY CREATED NAMED LIST THAT GOES BY "TheList" THAT THE MACRO WILL REFERENCE INSTEAD OF THE WORKSHEET)
<table style="width: 354px; height: 168px;" border="0" cellpadding="0" cellspacing="0"><col style="mso-width-source:userset;mso-width-alt:1223;width:26pt" width="34"> <col style="mso-width-source:userset;mso-width-alt:1792; width:38pt" width="50" span="2"> <col style="mso-width-source:userset;mso-width-alt:4664;width:98pt" width="131"> <tbody><tr style="height:14.4pt" height="19"> <td class="xl67" style="height:14.4pt;width:26pt" width="34" height="19">BW</td> <td class="xl68" style="border-left:none;width:38pt" width="50">Class</td> <td class="xl68" style="border-left:none;width:38pt" width="50">Make</td> <td class="xl69" style="border-left:none;width:98pt" width="131">Function</td> </tr> <tr style="height:14.4pt" height="19"> <td class="xl66" style="height:14.4pt;border-top:none" height="19">1</td> <td class="xl65" style="border-top:none;border-left:none">NC 1</td> <td class="xl65" style="border-top:none;border-left:none">NC 1</td> <td class="xl65" style="border-top:none;border-left:none">Finance</td> </tr> <tr style="height:14.4pt" height="19"> <td class="xl66" style="height:14.4pt;border-top:none" height="19">2</td> <td class="xl65" style="border-top:none;border-left:none">NC 8</td> <td class="xl65" style="border-top:none;border-left:none">NC 8</td> <td class="xl65" style="border-top:none;border-left:none">Project Management</td> </tr> <tr style="height:14.4pt" height="19"> <td class="xl66" style="height:14.4pt;border-top:none" height="19">3</td> <td class="xl65" style="border-top:none;border-left:none">NC 9</td> <td class="xl65" style="border-top:none;border-left:none">NC 9</td> <td class="xl65" style="border-top:none;border-left:none">Quality Assurance</td> </tr> <tr style="height:14.4pt" height="19"> <td class="xl66" style="height:14.4pt;border-top:none" height="19">4</td> <td class="xl65" style="border-top:none;border-left:none">NS 4</td> <td class="xl65" style="border-top:none;border-left:none">NS 4</td> <td class="xl65" style="border-top:none;border-left:none">Engineering</td> </tr> <tr style="height:14.4pt" height="19"> <td class="xl66" style="height:14.4pt;border-top:none" height="19">5</td> <td class="xl65" style="border-top:none;border-left:none">NS 7</td> <td class="xl65" style="border-top:none;border-left:none">NS 7</td> <td class="xl65" style="border-top:none;border-left:none">Accounting</td> </tr> </tbody></table>
I created the Before Macro and After Macro worksheets just to illustrate what happens to the data when the Macro is executed. In reality, this excel workbook would only contain 2 worksheets (The first worksheet will go by the name "Dataset" and 2nd worksheet will go by the name "DataList").
MACRO Explanation: What I want the Macro to do is populate the cells under 3 columns “Class”, “Make”, “Function” from the list on the “DataList” worksheet (I created a Named List called “TheList” that the macro can reference as oppose to referencing the worksheet) based on the value under the column “BW”.
I’ve used a lookup function to accomplish this task and it works fine, but I would like to use a Macro instead.
Thanks,
BC
In the excel file that I am using I have 3 worksheets and I will explain their purpose below:
1. Before Macro – This worksheet represents the actual data that I will be importing into excel from an external data source
<table style="width: 785px; height: 210px;" border="0" cellpadding="0" cellspacing="0"><col style="mso-width-source:userset;mso-width-alt:2787;width:59pt" width="78"> <col style="mso-width-source:userset;mso-width-alt:2759;width:58pt" width="78"> <col style="mso-width-source:userset;mso-width-alt:1507;width:32pt" width="42"> <col style="mso-width-source:userset;mso-width-alt:1223;width:26pt" width="34"> <col style="mso-width-source:userset;mso-width-alt:1792;width:38pt" width="50"> <col style="mso-width-source:userset;mso-width-alt:2218;width:47pt" width="62"> <col style="mso-width-source:userset;mso-width-alt:1962;width:41pt" width="55"> <col style="width:48pt" width="64"> <tbody><tr style="height:14.4pt" height="19"> <td class="xl71" style="height:14.4pt;width:59pt" width="78" height="19">Report Date</td> <td class="xl66" style="border-left:none;width:58pt" width="78">EmployeeID</td> <td class="xl72" style="border-left:none;width:32pt" width="42">Name</td> <td class="xl66" style="border-left:none;width:26pt" width="34">BW</td> <td class="xl66" style="border-left:none;width:38pt" width="50">Class</td> <td class="xl66" style="border-left:none;width:47pt" width="62">Make</td> <td class="xl66" style="border-left:none;width:41pt" width="55">Function</td> <td class="xl67" style="border-left:none;width:48pt" width="64">Hours</td> </tr> <tr style="height:14.4pt" height="19"> <td class="xl73" style="height:14.4pt;border-top:none" height="19">6/9/2011</td> <td class="xl65" style="border-top:none;border-left:none">1</td> <td class="xl65" style="border-top:none;border-left:none">Mike</td> <td class="xl65" style="border-top:none;border-left:none">3</td> <td class="xl65" style="border-top:none;border-left:none"> </td> <td class="xl65" style="border-top:none;border-left:none"> </td> <td class="xl65" style="border-top:none;border-left:none"> </td> <td class="xl65" style="border-top:none;border-left:none">2</td> </tr> <tr style="height:14.4pt" height="19"> <td class="xl73" style="height:14.4pt;border-top:none" height="19">6/9/2011</td> <td class="xl65" style="border-top:none;border-left:none">2</td> <td class="xl65" style="border-top:none;border-left:none">Tim</td> <td class="xl65" style="border-top:none;border-left:none">1</td> <td class="xl65" style="border-top:none;border-left:none"> </td> <td class="xl65" style="border-top:none;border-left:none"> </td> <td class="xl65" style="border-top:none;border-left:none"> </td> <td class="xl65" style="border-top:none;border-left:none">4</td> </tr> <tr style="height:14.4pt" height="19"> <td class="xl73" style="height:14.4pt;border-top:none" height="19">6/9/2011</td> <td class="xl65" style="border-top:none;border-left:none">3</td> <td class="xl65" style="border-top:none;border-left:none">Jen</td> <td class="xl65" style="border-top:none;border-left:none">5</td> <td class="xl65" style="border-top:none;border-left:none"> </td> <td class="xl65" style="border-top:none;border-left:none"> </td> <td class="xl65" style="border-top:none;border-left:none"> </td> <td class="xl65" style="border-top:none;border-left:none">5</td> </tr> <tr style="height:14.4pt" height="19"> <td class="xl73" style="height:14.4pt;border-top:none" height="19">6/9/2011</td> <td class="xl65" style="border-top:none;border-left:none">4</td> <td class="xl65" style="border-top:none;border-left:none">Ben</td> <td class="xl65" style="border-top:none;border-left:none">3</td> <td class="xl65" style="border-top:none;border-left:none"> </td> <td class="xl65" style="border-top:none;border-left:none"> </td> <td class="xl65" style="border-top:none;border-left:none"> </td> <td class="xl65" style="border-top:none;border-left:none">9</td> </tr> <tr style="height:14.4pt" height="19"> <td class="xl73" style="height:14.4pt;border-top:none" height="19">6/9/2011</td> <td class="xl65" style="border-top:none;border-left:none">1</td> <td class="xl65" style="border-top:none;border-left:none">Mike</td> <td class="xl65" style="border-top:none;border-left:none">1</td> <td class="xl65" style="border-top:none;border-left:none"> </td> <td class="xl65" style="border-top:none;border-left:none"> </td> <td class="xl65" style="border-top:none;border-left:none"> </td> <td class="xl65" style="border-top:none;border-left:none">1</td> </tr> <tr style="height:14.4pt" height="19"> <td class="xl73" style="height:14.4pt;border-top:none" height="19">6/9/2011</td> <td class="xl65" style="border-top:none;border-left:none">5</td> <td class="xl65" style="border-top:none;border-left:none">Scott</td> <td class="xl65" style="border-top:none;border-left:none">4</td> <td class="xl65" style="border-top:none;border-left:none"> </td> <td class="xl65" style="border-top:none;border-left:none"> </td> <td class="xl65" style="border-top:none;border-left:none"> </td> <td class="xl65" style="border-top:none;border-left:none">6</td> </tr> <tr style="height:14.4pt" height="19"> <td class="xl73" style="height:14.4pt;border-top:none" height="19">6/9/2011</td> <td class="xl65" style="border-top:none;border-left:none">1</td> <td class="xl65" style="border-top:none;border-left:none">Mike</td> <td class="xl65" style="border-top:none;border-left:none">3</td> <td class="xl65" style="border-top:none;border-left:none"> </td> <td class="xl65" style="border-top:none;border-left:none"> </td> <td class="xl65" style="border-top:none;border-left:none"> </td> <td class="xl65" style="border-top:none;border-left:none">7</td> </tr> <tr style="height:14.4pt" height="19"> <td class="xl73" style="height:14.4pt;border-top:none" height="19">6/9/2011</td> <td class="xl65" style="border-top:none;border-left:none">2</td> <td class="xl65" style="border-top:none;border-left:none">Tim</td> <td class="xl65" style="border-top:none;border-left:none">1</td> <td class="xl65" style="border-top:none;border-left:none"> </td> <td class="xl65" style="border-top:none;border-left:none"> </td> <td class="xl65" style="border-top:none;border-left:none"> </td> <td class="xl65" style="border-top:none;border-left:none">8</td> </tr> </tbody></table>
2. After Macro – This worksheet shows what the data will look like after I run the macro
<table style="width: 792px; height: 273px;" border="0" cellpadding="0" cellspacing="0"><col style="mso-width-source:userset;mso-width-alt:2787;width:59pt" width="78"> <col style="mso-width-source:userset;mso-width-alt:2759;width:58pt" width="78"> <col style="mso-width-source:userset;mso-width-alt:1507;width:32pt" width="42"> <col style="mso-width-source:userset;mso-width-alt:1223;width:26pt" width="34"> <col style="mso-width-source:userset;mso-width-alt:1792;width:38pt" width="50"> <col style="mso-width-source:userset;mso-width-alt:1422;width:30pt" width="40"> <col style="mso-width-source:userset;mso-width-alt:3982;width:84pt" width="112"> <col style="mso-width-source:userset;mso-width-alt:1479;width:31pt" width="42"> <tbody><tr style="height:14.4pt" height="19"> <td class="xl71" style="height:14.4pt;width:59pt" width="78" height="19">Report Date</td> <td class="xl66" style="border-left:none;width:58pt" width="78">EmployeeID</td> <td class="xl72" style="border-left:none;width:32pt" width="42">Name</td> <td class="xl66" style="border-left:none;width:26pt" width="34">BW</td> <td class="xl66" style="border-left:none;width:38pt" width="50">Class</td> <td class="xl66" style="border-left:none;width:30pt" width="40">Make</td> <td class="xl66" style="border-left:none;width:84pt" width="112">Function</td> <td class="xl67" style="border-left:none;width:31pt" width="42">Hours</td> </tr> <tr style="height:14.4pt" height="19"> <td class="xl73" style="height:14.4pt;border-top:none" height="19">6/9/2011</td> <td class="xl65" style="border-top:none;border-left:none">1</td> <td class="xl65" style="border-top:none;border-left:none">Mike</td> <td class="xl65" style="border-top:none;border-left:none">3</td> <td class="xl65" style="border-top:none;border-left:none">NC 9</td> <td class="xl65" style="border-top:none;border-left:none">NC 9</td> <td class="xl65" style="border-top:none;border-left:none">Quality Assurance</td> <td class="xl65" style="border-top:none;border-left:none">2</td> </tr> <tr style="height:14.4pt" height="19"> <td class="xl73" style="height:14.4pt;border-top:none" height="19">6/9/2011</td> <td class="xl65" style="border-top:none;border-left:none">2</td> <td class="xl65" style="border-top:none;border-left:none">Tim</td> <td class="xl65" style="border-top:none;border-left:none">1</td> <td class="xl65" style="border-top:none;border-left:none">NC 1</td> <td class="xl65" style="border-top:none;border-left:none">NC 1</td> <td class="xl65" style="border-top:none;border-left:none">Finance</td> <td class="xl65" style="border-top:none;border-left:none">4</td> </tr> <tr style="height:14.4pt" height="19"> <td class="xl73" style="height:14.4pt;border-top:none" height="19">6/9/2011</td> <td class="xl65" style="border-top:none;border-left:none">3</td> <td class="xl65" style="border-top:none;border-left:none">Jen</td> <td class="xl65" style="border-top:none;border-left:none">5</td> <td class="xl65" style="border-top:none;border-left:none">NS 7</td> <td class="xl65" style="border-top:none;border-left:none">NS 7</td> <td class="xl65" style="border-top:none;border-left:none">Accounting</td> <td class="xl65" style="border-top:none;border-left:none">5</td> </tr> <tr style="height:14.4pt" height="19"> <td class="xl73" style="height:14.4pt;border-top:none" height="19">6/9/2011</td> <td class="xl65" style="border-top:none;border-left:none">4</td> <td class="xl65" style="border-top:none;border-left:none">Ben</td> <td class="xl65" style="border-top:none;border-left:none">3</td> <td class="xl65" style="border-top:none;border-left:none">NC 9</td> <td class="xl65" style="border-top:none;border-left:none">NC 9</td> <td class="xl65" style="border-top:none;border-left:none">Quality Assurance</td> <td class="xl65" style="border-top:none;border-left:none">9</td> </tr> <tr style="height:14.4pt" height="19"> <td class="xl73" style="height:14.4pt;border-top:none" height="19">6/9/2011</td> <td class="xl65" style="border-top:none;border-left:none">1</td> <td class="xl65" style="border-top:none;border-left:none">Mike</td> <td class="xl65" style="border-top:none;border-left:none">1</td> <td class="xl65" style="border-top:none;border-left:none">NC 1</td> <td class="xl65" style="border-top:none;border-left:none">NC 1</td> <td class="xl65" style="border-top:none;border-left:none">Finance</td> <td class="xl65" style="border-top:none;border-left:none">1</td> </tr> <tr style="height:14.4pt" height="19"> <td class="xl73" style="height:14.4pt;border-top:none" height="19">6/9/2011</td> <td class="xl65" style="border-top:none;border-left:none">5</td> <td class="xl65" style="border-top:none;border-left:none">Scott</td> <td class="xl65" style="border-top:none;border-left:none">4</td> <td class="xl65" style="border-top:none;border-left:none">NS 4</td> <td class="xl65" style="border-top:none;border-left:none">NS 4</td> <td class="xl65" style="border-top:none;border-left:none">Engineering</td> <td class="xl65" style="border-top:none;border-left:none">6</td> </tr> <tr style="height:14.4pt" height="19"> <td class="xl73" style="height:14.4pt;border-top:none" height="19">6/9/2011</td> <td class="xl65" style="border-top:none;border-left:none">1</td> <td class="xl65" style="border-top:none;border-left:none">Mike</td> <td class="xl65" style="border-top:none;border-left:none">3</td> <td class="xl65" style="border-top:none;border-left:none">NC 9</td> <td class="xl65" style="border-top:none;border-left:none">NC 9</td> <td class="xl65" style="border-top:none;border-left:none">Quality Assurance</td> <td class="xl65" style="border-top:none;border-left:none">7</td> </tr> <tr style="height:14.4pt" height="19"> <td class="xl73" style="height:14.4pt;border-top:none" height="19">6/9/2011</td> <td class="xl65" style="border-top:none;border-left:none">2</td> <td class="xl65" style="border-top:none;border-left:none">Tim</td> <td class="xl65" style="border-top:none;border-left:none">1</td> <td class="xl65" style="border-top:none;border-left:none">NC 1</td> <td class="xl65" style="border-top:none;border-left:none">NC 1</td> <td class="xl65" style="border-top:none;border-left:none">Finance</td> <td class="xl65" style="border-top:none;border-left:none">8</td> </tr> </tbody></table>
3. DataList – This worksheet contains a list of items that the macro will use (I ACTUALLY CREATED NAMED LIST THAT GOES BY "TheList" THAT THE MACRO WILL REFERENCE INSTEAD OF THE WORKSHEET)
<table style="width: 354px; height: 168px;" border="0" cellpadding="0" cellspacing="0"><col style="mso-width-source:userset;mso-width-alt:1223;width:26pt" width="34"> <col style="mso-width-source:userset;mso-width-alt:1792; width:38pt" width="50" span="2"> <col style="mso-width-source:userset;mso-width-alt:4664;width:98pt" width="131"> <tbody><tr style="height:14.4pt" height="19"> <td class="xl67" style="height:14.4pt;width:26pt" width="34" height="19">BW</td> <td class="xl68" style="border-left:none;width:38pt" width="50">Class</td> <td class="xl68" style="border-left:none;width:38pt" width="50">Make</td> <td class="xl69" style="border-left:none;width:98pt" width="131">Function</td> </tr> <tr style="height:14.4pt" height="19"> <td class="xl66" style="height:14.4pt;border-top:none" height="19">1</td> <td class="xl65" style="border-top:none;border-left:none">NC 1</td> <td class="xl65" style="border-top:none;border-left:none">NC 1</td> <td class="xl65" style="border-top:none;border-left:none">Finance</td> </tr> <tr style="height:14.4pt" height="19"> <td class="xl66" style="height:14.4pt;border-top:none" height="19">2</td> <td class="xl65" style="border-top:none;border-left:none">NC 8</td> <td class="xl65" style="border-top:none;border-left:none">NC 8</td> <td class="xl65" style="border-top:none;border-left:none">Project Management</td> </tr> <tr style="height:14.4pt" height="19"> <td class="xl66" style="height:14.4pt;border-top:none" height="19">3</td> <td class="xl65" style="border-top:none;border-left:none">NC 9</td> <td class="xl65" style="border-top:none;border-left:none">NC 9</td> <td class="xl65" style="border-top:none;border-left:none">Quality Assurance</td> </tr> <tr style="height:14.4pt" height="19"> <td class="xl66" style="height:14.4pt;border-top:none" height="19">4</td> <td class="xl65" style="border-top:none;border-left:none">NS 4</td> <td class="xl65" style="border-top:none;border-left:none">NS 4</td> <td class="xl65" style="border-top:none;border-left:none">Engineering</td> </tr> <tr style="height:14.4pt" height="19"> <td class="xl66" style="height:14.4pt;border-top:none" height="19">5</td> <td class="xl65" style="border-top:none;border-left:none">NS 7</td> <td class="xl65" style="border-top:none;border-left:none">NS 7</td> <td class="xl65" style="border-top:none;border-left:none">Accounting</td> </tr> </tbody></table>
I created the Before Macro and After Macro worksheets just to illustrate what happens to the data when the Macro is executed. In reality, this excel workbook would only contain 2 worksheets (The first worksheet will go by the name "Dataset" and 2nd worksheet will go by the name "DataList").
MACRO Explanation: What I want the Macro to do is populate the cells under 3 columns “Class”, “Make”, “Function” from the list on the “DataList” worksheet (I created a Named List called “TheList” that the macro can reference as oppose to referencing the worksheet) based on the value under the column “BW”.
I’ve used a lookup function to accomplish this task and it works fine, but I would like to use a Macro instead.
Thanks,
BC
Last edited: