ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   checked the equal values from cells (https://www.excelbanter.com/excel-programming/359992-checked-equal-values-cells.html)

kar[_2_]

checked the equal values from cells
 

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


--
kar
------------------------------------------------------------------------
kar's Profile: http://www.excelforum.com/member.php...o&userid=33922
View this thread: http://www.excelforum.com/showthread...hreadid=536996


Ikaabod[_28_]

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



All times are GMT +1. The time now is 01:40 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com