Need help to compare /equal

elmnas

Board Regular
Joined
Feb 20, 2015
Messages
206
Hello guys
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
 
Last edited:

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Do what, when the match is found ??

Code:
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
        'do soemthing
    End If
Next r
End Sub
 
Last edited:
Upvote 0
Do what, when the match is found ??

Code:
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
        'do soemthing
    End If
Next r
End Sub

Make a string of the found and alert it :)
 
Upvote 0
I would like to have a msgbox that alert the found value (also make a string) is it possible?
 
Upvote 0
already solved

Code:
Sub CheckMatch()
For i = 4 To 210
    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
 
Upvote 0

Forum statistics

Threads
1,202,984
Messages
6,052,914
Members
444,612
Latest member
FajnaAli

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top