Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() I think in pseudo code it would work as something like this: for each row in sheet2 { if currentrow is white/nonhighlighted, leave alone and go to next row if currentrow is highlighted { for each row in sheet1 { if (sheet1.currentrow.zipcode = sheet2.currentrow.zipcode && sheet1.currentrow.firstcharname = sheet2.currentrow.firstcharname ) then currentrow is highlighted light yellow } } } Not sure if the logical is intact... Can someone convert this into actual macro code for excel? What I am trying to do is something like this: [previously :http://www.excelforum.com/showthread.php?t=534995] I got the code to do that, Option Explicit Sub CheckExists() Dim c As Range, cl As Range, rSearch As Range, rStart As Range Set rSearch = Worksheets("Siebel").Range("s1", Worksheets("Siebel").Range("s65536").End(xlUp)) Set rStart = Worksheets("Work").Range("B1", Worksheets("Work").Range("b65536").End(xlUp)) With Application .ScreenUpdating = False .Calculation = xlManual For Each cl In rStart With rSearch Set c = .Find(cl.Value, LookIn:=xlValues) If Not c Is Nothing Then c.EntireRow.Interior.ColorIndex = 3 End With Next cl .Application.ScreenUpdating = True .Calculation = xlCalculationAutomatic End With End Sub BUT is a way I can further refine the cross-reference matching. Since the list is over 31000+, matching by zip code narrowed it down significantly (I want see which customer records match with the Seibel Database) I first do a crude primitive search by zip code. Now that I have it automated that step is over and completed. But of the matches by Zip code not all the records actually match.(in fact the VAST majority of them don't) More than one customer can share the same Zip code, but that does not mean they are the SAME customer. So now I have to go back and actually check all the matched to see if the customer 'name' fields also match. That of course, is much better than before but will still take a long time. Since most of the customers don't match, and only a few percent out of the already highlighted by zip actually will match also by name; is there a way to alter your macro to search for the first letter/character of the name field to see if the beginning character matches? I guess what I want it to do is something like this: The ones that are successfully found/matched by zip code are already highlighted (Excel color 18) The non-highlighted ones I do not want to deal with at all, so I can pretend they do not even exists. Of the highlighted ones, for each highlighted row compare that respective Zip Code field with the identical zip code or zip code(s) fields that were found in the earlier first stage match and compare to see if the first letter of the account name (not cap sensitive) match or not. (some customers are in acrymons and some spelled out, so search for first character will ensure its not a false negative) If there is a further match then then entire row is then highlighted a different color (say light yellow) if there is no match then it is left alone (stays as Excel color 18) Once this sub filter is done, it will still not guarantee that the Customers are the same. (Joe in 76016 is not James in 76016) But I would have significantly narrowed it down so much that checking the remainder by hand will not be a difficult task. http://www.freewebs.com/bxc2739/page2.htm Thanks -- bxc2739 ------------------------------------------------------------------------ bxc2739's Profile: http://www.excelforum.com/member.php...o&userid=32538 View this thread: http://www.excelforum.com/showthread...hreadid=535071 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro error after switching from Excel 2000 to Excel 2003 | Excel Discussion (Misc queries) | |||
Urgent Help Required on Excel Macro Problem | Excel Discussion (Misc queries) | |||
Display form from an VB application in Excel | Excel Discussion (Misc queries) | |||
Excel Range Value issue (Excel 97 Vs Excel 2003) | Excel Discussion (Misc queries) | |||
Zip Code Macro | Excel Worksheet Functions |