Leith Ross Wrote:
Hello Sal21,
This macro will do what you asked based on the information and
worksheets you provided. If you have any problems, you can reach me by
email at .
Code:
--------------------
Public Sub UpdateInvoices()
Dim Found As Boolean
Dim I As Long
Dim J As Long
Dim LastMasterRow As Long
Dim LastUserRow As Long
Dim WksMaster As Excel.Worksheet
Dim WksUser As Excel.Worksheet
Set WksMaster = Excel.Workbooks("Master.xls").Worksheets("Master")
Set WksUser = Excel.Workbooks("User.xls").Worksheets("User")
LastMasterRow = WksMaster.Cells(Rows.Count, "R").End(xlUp).Row
LastUserRow = WksUser.Cells(Rows.Count, "R").End(xlUp).Row
For J = 2 To LastUserRow
For I = 2 To LastMasterRow
If WksMaster.Cells(I, "R") = WksUser.Cells(J, "R") Then
Found = True
Exit For
Else
Found = False
End If
Next I
If Found Then
WksMaster.Cells(I, "Q") = WksUser.Cells(I, "Q")
Else
WksMaster.Cells(I, "Q") = "New"
End If
Next J
End Sub
--------------------
Sincerely,
Leith Ross
Hi, Leith Ross
Tks for code. It work well....
But, why not insert the value "new" in other cell of sheet MASTER, when
not exist correpondence from USER to MASTER?
I attache my sheet master with my idea...Your macro put the value new
only in cell 408 of MASTER
Sorry for my english but sure you have understand me, you have posted
me a good code.
Coffe a nd pizza are for you...
+-------------------------------------------------------------------+
|Filename: MASTER.zip |
|Download:
http://www.excelforum.com/attachment.php?postid=3937 |
+-------------------------------------------------------------------+
--
sal21
------------------------------------------------------------------------
sal21's Profile:
http://www.excelforum.com/member.php...fo&userid=2040
View this thread:
http://www.excelforum.com/showthread...hreadid=478329