I have a file where I am trying to determine if two ranges on two different worksheets match (Sales order and Sales amount). My purpose is to keep track of sales commissions I have paid during the year.
If Sales order abc (for example) for 10,000 on the Master worksheet (the year-to-date worksheet) appears in Feb(commissions for this month) with the sales order (abc) and 10,000, I would like the used range for that row to turn yellow.
It has been a while since I have written code for a each loop.
Again, the range would be on the Master YTD worksheet as an array of sales orders fro the entire year compared to the Feb worksheet which is an array of sales orders for the month of Feb. If their is a match for both Sales order and Sales amount on both sheets , I want all cells to turn yellow.
Thanks for your help.
when I run this code I get a "type mismatch" error.
I was just experimenting to see if this macro worked for one Sales order and amount on the two different worksheets.
Sub MatchingCells()
If Sheets("Jan CMA bookings").Range("B122").Value And Sheets("Jan CMA bookings").Range("c122").Value = _
Sheets("YTD CMA BOOKINGS").Range("A62").Value And Sheets("YTD CMA BOOKINGS").Range("B62").Value Then
cell.Interior.Color = vbYellow
End If