View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ikaabod[_28_] Ikaabod[_28_] is offline
external usenet poster
 
Posts: 1
Default checked the equal values from cells


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

kar Wrote:
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
ka


--
Ikaabo
-----------------------------------------------------------------------
Ikaabod's Profile: http://www.excelforum.com/member.php...fo&userid=3337
View this thread: http://www.excelforum.com/showthread.php?threadid=53699