![]() |
Can someone help me put psuedo code into actual excel macro??
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 |
Can someone help me put psuedo code into actual excel macro??
I hope that I have understood your complex question correctly. Have you considered adding an extra column which contains the customer and ZIP code concatentated and using this for your match? -- mrice Reserach Scientist with many years of spreadsheet development experience ------------------------------------------------------------------------ mrice's Profile: http://www.excelforum.com/member.php...o&userid=10931 View this thread: http://www.excelforum.com/showthread...hreadid=535071 |
All times are GMT +1. The time now is 10:46 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com