checked the equal values from cells

K

kar

that I can checked the equal values from cells two different worksheets

example

sheet1
A1= -10,01
A2= -10,01
A3=10,00
A4=10,02
A5=10,06


sheet2
A1= -10,01
A3=-10,00
A4=10,03
A6=10,06
A7= -10,01


request

sheet1
A1= -10,01 ok
A5=10,06 οκ

sheet2
A1= -10,01 ok
A6=10,06 οκ

thank you
kar
 
I

Ikaabod

There's probably a more efficient way to do this, but this is one way t
do it:

Sub Test()
Dim iTotalSheet1Rows As Integer
Dim iTotalSheet2Rows As Integer
iTotalSheet1Rows = Sheets("Sheet1").UsedRange.Rows.Count
iTotalSheet2Rows = Sheets("Sheet2").UsedRange.Rows.Count

For iRow = 1 To iTotalSheet1Rows
For iRow2 = 1 To iTotalSheet2Rows
If Sheets("Sheet1").Cells(iRow, 1).Value
Sheets("Sheet2").Cells(iRow2, 1).Value Then
Sheets("Sheet1").Cells(iRow, 2).Value = "OK"
Sheets("Sheet2").Cells(iRow2, 2).Value = "OK"
iRow2 = iTotalSheet2Rows
End If
Next iRow2
Next iRow

For iCount = 1 To iTotalSheet1Rows
For iCount2 = iCount + 1 To iTotalSheet1Rows
If Sheets("Sheet1").Cells(iCount, 1).Value
Sheets("Sheet1").Cells(iCount2, 1).Value Then
Sheets("Sheet1").Cells(iCount2, 2).Value = ""
End If
Next iCount2
Next iCount

For iCount3 = 1 To iTotalSheet2Rows
For iCount4 = iCount3 + 1 To iTotalSheet2Rows
If Sheets("Sheet2").Cells(iCount3, 1).Value
Sheets("Sheet2").Cells(iCount4, 1).Value Then
Sheets("Sheet2").Cells(iCount4, 2).Value = ""
End If
Next iCount4
Next iCount3
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top