![]() |
| If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|||||||
|
|
Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
I have 3 Sheets. In Sheet1 I have headings in row 1 and then data
which starts from row 2 and is like (see below) A B C D….col xx 333 yyy record xx 444 yyy power xx 222 yyy number zz 656 yyy record zz 454 yyy power zz 956 yyy number yy 888 yyy record yy 999 yyy power Same like Sheet1, In Sheet2 I have headings in row 1 and then data which starts from row2 and is like (see below) A ….col xx yy I want macro assigned to button in Sheet2 which should check Sheet2 column A cells value and match it with cells of column A of Sheet1. And if value matches then it should produce result in Sheet3 from row 2 like (see below) A B C ….col 333 yyy record 444 yyy power 222 yyy number 888 yyy record 999 yyy power The above result is actually the values in same row of matched values from column B to D of Sheet1. Please can any friend can help me in this |
| Ads |
|
#2
|
|||
|
|||
|
On Tue, 28 Jul 2009 07:45:37 -0700 (PDT), K >
wrote: >I have 3 Sheets. In Sheet1 I have headings in row 1 and then data >which starts from row 2 and is like (see below) > A B C D….col >xx 333 yyy record >xx 444 yyy power >xx 222 yyy number >zz 656 yyy record >zz 454 yyy power >zz 956 yyy number >yy 888 yyy record >yy 999 yyy power > >Same like Sheet1, In Sheet2 I have headings in row 1 and then data >which starts from row2 and is like (see below) >A ….col >xx >yy > >I want macro assigned to button in Sheet2 which should check Sheet2 >column A cells value and match it with cells of column A of Sheet1. >And if value matches then it should produce result in Sheet3 from row >2 like (see below) > > A B C ….col >333 yyy record >444 yyy power >222 yyy number >888 yyy record >999 yyy power > >The above result is actually the values in same row of matched values >from column B to D of Sheet1. Please can any friend can help me in >this Assuming that there is a blank cell below your data in column A in Sheet1 and Sheet2, you may try the following macro: Sub Button1_Click() Dim row1, row2, row3 As Integer row3 = 2 row2 = 2 While Worksheets("Sheet2").Cells(row2, 1) <> "" row1 = 2 While Worksheets("Sheet1").Cells(row1, 1) <> "" If Worksheets("Sheet1").Cells(row1, 1) = Worksheets("Sheet2").Cells(row2, 1) Then Worksheets("Sheet3").Cells(row3, 1) = Worksheets("Sheet1").Cells(row1, 2) Worksheets("Sheet3").Cells(row3, 2) = Worksheets("Sheet1").Cells(row1, 3) Worksheets("Sheet3").Cells(row3, 3) = Worksheets("Sheet1").Cells(row1, 4) row3 = row3 + 1 End If row1 = row1 + 1 Wend row2 = row2 + 1 Wend End Sub Hope this helps / Lars-Åke |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| match and extract | Dinesh | Excel Worksheet Functions | 5 | September 9th 09 07:24 PM |
| MATCH() and ISERROR() to extract set differences | Jim Fradkin | Excel Programming | 1 | January 9th 09 11:26 PM |
| Match and extract | Tom | Excel Programming | 2 | October 28th 07 01:05 AM |
| Help me, compare 2 sheet and extract the match data into the new sheet. | sweetnet | Excel Discussion (Misc queries) | 1 | February 22nd 06 07:49 PM |
| formula to extract specific data if match occurs | jerry | Excel Worksheet Functions | 2 | February 24th 05 11:06 AM |