matt_leonard
Board Regular
- Joined
- Dec 20, 2004
- Messages
- 51
Hi,
I am comparing 2 speadsheets / workbooks to see if the data on one sheets is on the other sheet and highlighting it if it is. The following code is fine for looking to see if the 2 cells match exactly but I now need another loop to go through column F which contains the same text but in the middle of a string in the cells. I need this to be highlighted also. Can anyone help? Thank you
MY_MATCH = 0
For MY_ROWS_1 = 2 To Sheets("Sheet1").Range("A65536").End(xlUp).Row
For MY_ROWS_2 = 2 To Sheets("A").Range("A65536").End(xlUp).Row
If Sheets("Sheet1").Range("F" & MY_ROWS_1).Value = _
Sheets("A").Range("K" & MY_ROWS_2).Value Then
Sheets("A").Range("K" & MY_ROWS_2).EntireRow.Font.ColorIndex = 5
MY_MATCH = 1
End If
Next MY_ROWS_2
MY_MATCH = 0
Next MY_ROWS_1
End Sub
I am comparing 2 speadsheets / workbooks to see if the data on one sheets is on the other sheet and highlighting it if it is. The following code is fine for looking to see if the 2 cells match exactly but I now need another loop to go through column F which contains the same text but in the middle of a string in the cells. I need this to be highlighted also. Can anyone help? Thank you
MY_MATCH = 0
For MY_ROWS_1 = 2 To Sheets("Sheet1").Range("A65536").End(xlUp).Row
For MY_ROWS_2 = 2 To Sheets("A").Range("A65536").End(xlUp).Row
If Sheets("Sheet1").Range("F" & MY_ROWS_1).Value = _
Sheets("A").Range("K" & MY_ROWS_2).Value Then
Sheets("A").Range("K" & MY_ROWS_2).EntireRow.Font.ColorIndex = 5
MY_MATCH = 1
End If
Next MY_ROWS_2
MY_MATCH = 0
Next MY_ROWS_1
End Sub