![]() |
IF Then Statements for comparison
Hello, i want to make a function for comparing two excel file.
If A2(xls1) is found in ColumnB(xls2) then check if B2(xls1) is equal to ColumnB(xls2) cell Result If equal then input "ok" in E2(xls1) if not equal the input "wrong" in E2(xls1) Else "Not Found" |
IF Then Statements for comparison
Sub Macro1()
Dim c As Range Dim rng As Range Dim bFound As Boolean Dim iEnd As Long Dim ws1 As Worksheet Dim ws2 As Worksheet Set ws1 = Sheets("Sheet1") Set ws2 = Workbooks("Book2").Sheets("Sheet1") iEnd = ws2.Range("B65536").End(xlUp).Row Set rng = ws2.Range("B1:B" & iEnd) For Each c In rng If ws1.Range("A2") = c Then If ws1.Range("B2") = c Then ws1.Range("E2") = "ok" Else ws1.Range("E2") = "wrong" End If bFound = True Exit For End If Next c If bFound = False Then ws1.Range("E2") = "Not Found" End If End Sub Hth, Merjet |
IF Then Statements for comparison
Hello, Thanks for giving me idea, but sorry I think i have not made my
explanation more clear. If A2(Worksheet1) is found in ColumnA(Worksheet2) then check if B2(Worksheet1) is equal to ColumnB(Worksheet2) cell Result "example of above: if it is found in B4(worksheet2), then compare it with B2(worksheet1)" If equal then input "ok" in E2(worksheet1) if not equal the input "wrong" in E2(worksheet1) Else "Not Found" |
IF Then Statements for comparison
hi, also I include screenshot of what I want to accomplish.
Thank you for your help http://glv.ne.jp/xls.JPG |
All times are GMT +1. The time now is 05:07 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com