Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks jay, it worked perfectly.
Is there any way, i can compare two columns from each worksheet. Like Company column name and the product column. Company name can be repeated multiple times with different products from the same company. and as i mentioned earlier product are located in column 7. First 4 rows have general headers and data start from row 5. I modified ear;ier code accordingly but i m having trouble when i try to compare company's name and the product listed for that row in column 7 to other sheet. Remember company names are not listed in same rows on bothsheets. for example in sheet 1 xyz company is in row 20 with product abc but in sheet two xyz is in row 19 with product abc. and then i have multiple instance like xyz with product bcd in column 15 in sheet 1 and in sheet 2 it is listed in column 10. Anyone Please Help with this issue. Thanks Henson Jay wrote: Hi henson1182 - Here's a draft procedure for you to try. Note that it checks for empty cells in column 2 of the 'current month list' and stamps such records with "N/A". Modify to suit. Sub henson1182() Const toprow = 1 '<<header row number Set wsa = Worksheets("SheetA") '<<current month sheet name Set wsb = Worksheets("SheetB") '<<last month sheet name lastrow = wsa.Cells(wsa.Rows.Count, 2).End(xlUp).Row Set curRng = wsa.Range(wsa.Cells(toprow + 1, 2), wsa.Cells(lastrow, 2)) Application.ScreenUpdating = False For Each itm In curRng If itm < "" Then If Not wsb.Columns(2).Find(itm) Is Nothing Then wsa.Cells(itm.Row, 9) = "Y" Else wsa.Cells(itm.Row, 9) = "N" End If Else wsa.Cells(itm.Row, 9) = "N/A" End If Next 'itm End Sub ---- Jay Hi, [quoted text clipped - 24 lines] Any kind of VBA Coding help will be greatly appreciated. -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200705/1 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
compare data from different worksheets and return matching results | Excel Discussion (Misc queries) | |||
Writing a macro to compare columns and return a value | Excel Discussion (Misc queries) | |||
How do I compare two columns and return a number count | Excel Worksheet Functions | |||
compare two worksheets and return a corresponding column | Excel Discussion (Misc queries) | |||
Compare 2 Worksheets and return differences in a third. | Excel Worksheet Functions |