Excel VBA : Checking if the data match between 2 sheets

Versonol

New Member
Joined
Jul 10, 2022
Messages
17
Office Version
  1. 365
Platform
  1. Windows
1665595724272.png
1665595790252.png


I am currently trying to use another sheet as a reference to check my main sheet which for this example would be the "working hours sheet" as my reference. For example, if the working hours for both sheets is 11, it'll check if the rows with 11 working hours in the Name sheet has one of the same code present in the Jobcode for 11 Working hours which would be LY,HR,DR . If it doesn't match it'll highlight the row in the name sheet which in this case row 6 would be highlighted

Sorry for the bad English.

Here's the code I was working on

Set n = Worksheets("Names")
Set wh = Worksheets("Working Hours")
Dim i As Long, lrow As Long
Dim v As Long
lrow = ws.Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 To 100
For v = 1 To 100
If n.Cells(v, "D").Value = wh.Cells(i, "A") Then
If wh.Cells(i, "B") <> n.Cells(v, "C") Then n.Cells(i, 1).EntireRow.Interior.ColorIndex = 9
Next i
Next v
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December

Forum statistics

Threads
1,214,806
Messages
6,121,672
Members
449,045
Latest member
Marcus05

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top