ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Need Quick Macro Help! (https://www.excelbanter.com/excel-discussion-misc-queries/84896-need-quick-macro-help.html)

bxc2739

Need Quick Macro Help!
 

I have _two_sheets__*1* & *2*. I’m to *match* customer from sheet 2 to
1.

I want to match by *zip code and by name*. If zip AND name of row(x)
in sheet 2
Matches with zip AND name of _ANY_of the 5000+ row(s) in sheet 1 then
highlight row(x) in sheet2. (to indicate a match)
If no match are found, then do nothing, and move on to next row of
sheet2 until all rows of sheet2 are finished comparing to the sheet1.

Basically *I need to compare TWO fields simultaneiously*, (double
match)
_per_row_to_the_respective_TWO_fields_with_the_sec ond_sheet_I_am_comparing_too._
*If both criteria are meet then it is a match. * Otherwise it is left
alone/ignored. I want to do this for all 35000+ rows in my sheet2 which
will take a long time without the help of a macro. Both the sheet to be
worked on (sheet 2) and the sheet that exists only for comparison
(sheet1) are huge and have many entries.

If anyone can help with the code that would be great!


Thanks
Bo


--
bxc2739
------------------------------------------------------------------------
bxc2739's Profile: http://www.excelforum.com/member.php...o&userid=32538
View this thread: http://www.excelforum.com/showthread...hreadid=535657


bxc2739

Need Quick Macro Help!
 

Additionally:

I have already succeeding in comparing ONLY the zip code.

Here is the code:

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
cl.EntireRow.Interior.ColorIndex = 3
End With
Next cl

.Application.ScreenUpdating = True
.Calculation = xlCalculationAutomatic
End With
End Sub

royUk at ozgrid gave me this code and it works wonderfully

What I need to do now is the *second step*:
_How_do_I_compare_AT_THE_SAME_TIME_both_the_ZIP_CO DE_(numeric)_AND_the_CUSTOMER_NAME_(string/character/word)_of_sheet2_to_the_Zip_and_Name_of_sheet1.??_

Do I need a nested FOR LOOP or a seperate for Loop after the first
one??
How shall I go about coding this? I've tried a lot of things but it
never works..


--
bxc2739
------------------------------------------------------------------------
bxc2739's Profile: http://www.excelforum.com/member.php...o&userid=32538
View this thread: http://www.excelforum.com/showthread...hreadid=535657


bxc2739

Need Quick Macro Help!
 

Here is a picture for clarity:

http://www.freewebs.com/bxc2739/help.bmp


+-------------------------------------------------------------------+
|Filename: help.JPG |
|Download: http://www.excelforum.com/attachment.php?postid=4687 |
+-------------------------------------------------------------------+

--
bxc2739
------------------------------------------------------------------------
bxc2739's Profile: http://www.excelforum.com/member.php...o&userid=32538
View this thread: http://www.excelforum.com/showthread...hreadid=535657



All times are GMT +1. The time now is 09:42 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com