View Full Version : [SOLVED:] Match two different columns
elmnas
05-27-2015, 12:00 AM
Hello people
script that loops through cells in column J and K
I need a statement
if the textcontent in a cell in Column J and Column K same row have same value example "test" then do something
alert the instances
Could someone help me ?
Thank you in advance
elmnas
05-27-2015, 12:45 AM
I got this code so far:
Sub MM1()Dim lr As Long, r As Long
lr = Cells(Rows.Count, "J").End(xlUp).Row
For r = lr To 1 Step -1
If Range("J" & r).Value = Range("K" & r).Value Then
'how do I alert the found value and make string here??
End If
Next r
End Sub
elmnas
05-27-2015, 01:13 AM
Sub CheckMatch()
For i = 2 To 230
If Cells(i, "J") = Cells(i, "K") And Len(Cells(i, "B")) <> 0 And Cells(i, "AB") <> 0 Then
MsgBox "Row " & i & " match"
End If
Next i
End Sub
I got this code so far
but I do specify how the cells count 2 to 230
how do I modify the code it goes to the last row that have no value?
mancubus
05-27-2015, 02:49 AM
see my post in below threads of yours:
http://www.vbaexpress.com/forum/showthread.php?52693-Compare-two-cell-in-two-columns-and-present-in-new-column
and
http://www.vbaexpress.com/forum/showthread.php?52705-Need-to-loop-until-last-cell-need-to-modify
elmnas
05-27-2015, 07:26 AM
Thank you mancubus!
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.