ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Finding matching rows on two worksheets (https://www.excelbanter.com/excel-programming/358781-finding-matching-rows-two-worksheets.html)

Wire323[_3_]

Finding matching rows on two worksheets
 

I'm trying to compare rows on 2 worksheets. If there are matches then I
want to take the rows off of the 1st worksheet and move it to a 3rd
one.

My 1st worksheet consists of "admin calls." Column A is the phone
number, H is the date, and F is the start time.

My 2nd worksheet consists of "all calls." Column I is the phone, B is
the date, and C is the start time.

I want to look at each row of the 1st worksheet, and try to find a
matching row on the 2nd. A match will mean the phone number, date, and
start time are all the same. If it finds a match, then I want to copy
the value of Column B on the 1st worksheet to COlumn M on the 2nd.
I'll then take the row off of the 1st worksheet and move it to a 3rd
worksheet (called "matches").

Any help will be greatly appreciated. This is the last piece of a
project I'm working on to make our billing girl's life a lot easier.


If I need to explain anything better then please let me know. I'm
posting this question in a few different forums.

Thanks.


--
Wire323
------------------------------------------------------------------------
Wire323's Profile: http://www.excelforum.com/member.php...o&userid=33218
View this thread: http://www.excelforum.com/showthread...hreadid=532530


davidm

Finding matching rows on two worksheets
 

Try:
(not tested)


Sub m()
set ws1 = Worksheets("AdminCalls")
set ws2=WorkSheets("AllCalls")
set ws3=WorkSheets("Matches")

For each c in ws.Range("a:f")
For each k in ws2.Range("a:i")
if c.value = k.Offset(0,9).value and c.Offset(0,8).value
k.Offset(0,2).value And c.Offset(0,6).value = k.Offset(0,3).value Then
c.offset(0,1).copy k.Offset(0,13)
c.EntireRow.Copy ws3.Range("a" & Range("a65536").end(xlUp).Row)
end if
next
next

end su

--
david
-----------------------------------------------------------------------
davidm's Profile: http://www.excelforum.com/member.php...fo&userid=2064
View this thread: http://www.excelforum.com/showthread.php?threadid=53253


Wire323[_4_]

Finding matching rows on two worksheets
 

I posted a sample of my workbook at
http://www.ozgrid.com/forum/showthre...d=1#post251349.

I also explained what I'm trying to do in a little more detail.

Thanks.


--
Wire323
------------------------------------------------------------------------
Wire323's Profile: http://www.excelforum.com/member.php...o&userid=33218
View this thread: http://www.excelforum.com/showthread...hreadid=532530



All times are GMT +1. The time now is 10:00 AM.

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