+ Reply to Thread
Results 1 to 2 of 2

checked the equal values from cells

  1. #1
    Registered User
    Join Date
    04-27-2006
    Posts
    1

    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

  2. #2
    Valued Forum Contributor
    Join Date
    04-11-2006
    Posts
    407
    There's probably a more efficient way to do this, but this is one way to 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

    Quote Originally Posted by 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

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1