abi_learn_vba
Board Regular
- Joined
- Nov 6, 2009
- Messages
- 215
Hi,
I have two column of data column B has "Branch" and column C has "Territory" as shown below in Sheet1
<table width="189" border="0" cellpadding="0" cellspacing="0"><col style="mso-width-source:userset;mso-width-alt:3181;width:65pt" width="87"> <col style="mso-width-source:userset;mso-width-alt:3730;width:77pt" width="102"> <tbody><tr style="height:15.0pt" height="20"> <td class="xl63" style="height:15.0pt;width:65pt" height="20" width="87">BRANCH </td> <td class="xl63" style="width:77pt" width="102">TERRITORY </td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl63" style="height:15.0pt" height="20">6432</td> <td class="xl63">300</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl63" style="height:15.0pt" height="20">6432</td> <td class="xl63">300</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl63" style="height:15.0pt" height="20">6432</td> <td class="xl63">300</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl63" style="height:15.0pt" height="20">6432</td> <td class="xl63">301</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl63" style="height:15.0pt" height="20">6432</td> <td class="xl63">204</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl63" style="height:15.0pt" height="20">6432</td> <td class="xl63">404</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl63" style="height:15.0pt" height="20">6432</td> <td class="xl63">303</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl63" style="height:15.0pt" height="20">6432</td> <td class="xl63">303</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl63" style="height:15.0pt" height="20">6432</td> <td class="xl63">303</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl63" style="height:15.0pt" height="20">6432</td> <td class="xl63">402</td> </tr> </tbody></table>
In Sheet2 Column A,B, C has value as shown below
<table width="253" border="0" cellpadding="0" cellspacing="0"><col style="mso-width-source:userset;mso-width-alt:3181;width:65pt" width="87"> <col style="mso-width-source:userset;mso-width-alt:3730;width:77pt" width="102"> <col style="width:48pt" width="64"> <tbody><tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt;width:65pt" height="20" width="87">BRANCH </td> <td class="xl65" style="width:77pt" width="102">TERRITORY </td> <td class="xl65" style="width:48pt" width="64">Code</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt" height="20">6432</td> <td class="xl65">300</td> <td class="xl65">A1</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt" height="20">6432</td> <td class="xl65">300</td> <td class="xl65">A1</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt" height="20">6432</td> <td class="xl65">300</td> <td class="xl65">A1</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt" height="20">6432</td> <td class="xl65">301</td> <td class="xl65">C1</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt" height="20">6432</td> <td class="xl65">204</td> <td class="xl65">D1</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt" height="20">6432</td> <td class="xl65">404</td> <td class="xl65">E1</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt" height="20">6432</td> <td class="xl65">303</td> <td class="xl65">K1</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt" height="20">6432</td> <td class="xl65">303</td> <td class="xl65">K1</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt" height="20">6432</td> <td class="xl65">303</td> <td class="xl65">K1</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt" height="20">6432</td> <td class="xl65">402</td> <td class="xl65">Z1</td> </tr> </tbody></table>
My requirement is to check for match column B and C from sheet1 to column A and B of sheet2 and bring the corresponding "code" value to their respective column A in sheet1
I want this to be done using VBA, i tried various method but couldn't succeed. Can any one help in giving me the how should i go about with this.. what function or code can i use..
Cheers
-Abi
I have two column of data column B has "Branch" and column C has "Territory" as shown below in Sheet1
<table width="189" border="0" cellpadding="0" cellspacing="0"><col style="mso-width-source:userset;mso-width-alt:3181;width:65pt" width="87"> <col style="mso-width-source:userset;mso-width-alt:3730;width:77pt" width="102"> <tbody><tr style="height:15.0pt" height="20"> <td class="xl63" style="height:15.0pt;width:65pt" height="20" width="87">BRANCH </td> <td class="xl63" style="width:77pt" width="102">TERRITORY </td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl63" style="height:15.0pt" height="20">6432</td> <td class="xl63">300</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl63" style="height:15.0pt" height="20">6432</td> <td class="xl63">300</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl63" style="height:15.0pt" height="20">6432</td> <td class="xl63">300</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl63" style="height:15.0pt" height="20">6432</td> <td class="xl63">301</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl63" style="height:15.0pt" height="20">6432</td> <td class="xl63">204</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl63" style="height:15.0pt" height="20">6432</td> <td class="xl63">404</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl63" style="height:15.0pt" height="20">6432</td> <td class="xl63">303</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl63" style="height:15.0pt" height="20">6432</td> <td class="xl63">303</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl63" style="height:15.0pt" height="20">6432</td> <td class="xl63">303</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl63" style="height:15.0pt" height="20">6432</td> <td class="xl63">402</td> </tr> </tbody></table>
In Sheet2 Column A,B, C has value as shown below
<table width="253" border="0" cellpadding="0" cellspacing="0"><col style="mso-width-source:userset;mso-width-alt:3181;width:65pt" width="87"> <col style="mso-width-source:userset;mso-width-alt:3730;width:77pt" width="102"> <col style="width:48pt" width="64"> <tbody><tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt;width:65pt" height="20" width="87">BRANCH </td> <td class="xl65" style="width:77pt" width="102">TERRITORY </td> <td class="xl65" style="width:48pt" width="64">Code</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt" height="20">6432</td> <td class="xl65">300</td> <td class="xl65">A1</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt" height="20">6432</td> <td class="xl65">300</td> <td class="xl65">A1</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt" height="20">6432</td> <td class="xl65">300</td> <td class="xl65">A1</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt" height="20">6432</td> <td class="xl65">301</td> <td class="xl65">C1</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt" height="20">6432</td> <td class="xl65">204</td> <td class="xl65">D1</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt" height="20">6432</td> <td class="xl65">404</td> <td class="xl65">E1</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt" height="20">6432</td> <td class="xl65">303</td> <td class="xl65">K1</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt" height="20">6432</td> <td class="xl65">303</td> <td class="xl65">K1</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt" height="20">6432</td> <td class="xl65">303</td> <td class="xl65">K1</td> </tr> <tr style="height:15.0pt" height="20"> <td class="xl65" style="height:15.0pt" height="20">6432</td> <td class="xl65">402</td> <td class="xl65">Z1</td> </tr> </tbody></table>
My requirement is to check for match column B and C from sheet1 to column A and B of sheet2 and bring the corresponding "code" value to their respective column A in sheet1
I want this to be done using VBA, i tried various method but couldn't succeed. Can any one help in giving me the how should i go about with this.. what function or code can i use..
Cheers
-Abi