montecarlo2012
Well-known Member
- Joined
- Jan 26, 2011
- Messages
- 984
- Office Version
- 2010
- Platform
- Windows
Hi.
Please, I am trying in a very basic ordinary way to compare two arrays.
I need to compare every row on Sheet 2 to every row on sheet 1 and highlight on 1
only as ilustration what I am doing is this:
for better understanding about what I try.
thanks
Please, I am trying in a very basic ordinary way to compare two arrays.
I need to compare every row on Sheet 2 to every row on sheet 1 and highlight on 1
only as ilustration what I am doing is this:
VBA Code:
Sub t()
Dim A As Integer, B As Integer, C As Integer, D As Integer, E As Integer, F As Integer
B = Sheet2.Range("H2").Value
A = Sheet1.Range("B2").Value
If A = B Then
Sheet1.Range("B2").Interior.ColorIndex = 6
Else
Sheet1.Range("B2").Interior.ColorIndex = 0
End If
'/////////////////////////////////////////////////////////////////////////
C = Sheet2.Range("I2").Value
D = Sheet1.Range("C2").Value
If C = D Then
Sheet1.Range("C2").Interior.ColorIndex = 6
Else
Sheet1.Range("C2").Interior.ColorIndex = 0
End If
'//////////////////////////////////////////////////////////////////////////
E = Sheet2.Range("J2").Value
F = Sheet1.Range("D2").Value
If E = F Then
Sheet1.Range("D2").Interior.ColorIndex = 6
Else
Sheet1.Range("D2").Interior.ColorIndex = 0
End If
End Sub
thanks