IF "MATCH" is FOUND is myrange THEN "MATCH" - Help needed please

Sphinx404

Board Regular
Joined
May 2, 2015
Messages
186
Office Version
  1. 365
Platform
  1. Windows
I'm trying to write in a procedure that will:

IF AL2, AM2, AN2 = "MATCH" THEN
range("AO").value = "MATCHES"

more or less, if the word "MATCH" is found in any of the cells AL2, AM2, or AN2 then I need AO2 to return "MATCHES". If not, then "NO MATCH"

then loop it.

THANKS GENTS

Code:
Sub step16nick()


Dim row As Double
Dim code1 As String
Dim code2 As String
Dim code3 As String


row = 2


Do Until Range("AD" & row).FormulaR1C1 = ""


code1 = Range("AD" & row).Value
code2 = Range("AE" & row).Value
code3 = Range("AF" & row).Value




If code1 = Range("AG" & row).Value Then Range("AL" & row).Value = "MATCH"
If code1 = Range("AH" & row).Value Then Range("AL" & row).Value = "MATCH"
If code1 = Range("AI" & row).Value Then Range("AL" & row).Value = "MATCH"
If code1 = Range("AJ" & row).Value Then Range("AL" & row).Value = "MATCH"
If code1 = Range("AK" & row).Value Then Range("AL" & row).Value = "MATCH"


If code2 = Range("AG" & row).Value Then Range("AM" & row).Value = "MATCH"
If code2 = Range("AH" & row).Value Then Range("AM" & row).Value = "MATCH"
If code2 = Range("AI" & row).Value Then Range("AM" & row).Value = "MATCH"
If code2 = Range("AJ" & row).Value Then Range("AM" & row).Value = "MATCH"
If code2 = Range("AK" & row).Value Then Range("AM" & row).Value = "MATCH"


If code3 = Range("AG" & row).Value Then Range("AN" & row).Value = "MATCH"
If code3 = Range("AH" & row).Value Then Range("AN" & row).Value = "MATCH"
If code3 = Range("AI" & row).Value Then Range("AN" & row).Value = "MATCH"
If code3 = Range("AJ" & row).Value Then Range("AN" & row).Value = "MATCH"
If code3 = Range("AK" & row).Value Then Range("AN" & row).Value = "MATCH"


row = row + 1


Loop


End Sub
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
This should do it.

Code:
lastRow = Cells(Rows.Count, "A").End(xlUp).Row
For i = row To lastRow[INDENT]If Cells(i, "AL") = "MATCH" Or Cells(i, "AM") = "MATCH" Or Cells(i, "AN") = "MATCH" Then[/INDENT]
[INDENT=2]Cells(i, "AO") = "MATCHES"[/INDENT]
[INDENT]Else[/INDENT]
[INDENT=2]Cells(i, "AO") = "NO MATCH"[/INDENT]
[INDENT]End If[/INDENT]
Next i
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,327
Members
452,635
Latest member
laura12345

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