Hi,
New to VBA. I have a large set of data that I need to go through. Now I am filtering multiple columns to see if it contains certain text, then entering value into 2 columns. So I'm looking for a macro that can search multiple columns for a pre-determined value and if present, then display texts in 2 columns. For example: If cells in column A contain "ADJ" then show "NO" in AB and "REASON" in AC & if cells in column S contain "CORP" then show "YES" in column AB and "REASON" in column AC. There are more columns that I need to search through but I'm not going to list them all so it'd be nice if I can apply this to maybe 4 columns.
I've found a code by @My Aswer Is This that works on one column but I'm not able to figure out how to edit the code so that I can use it on multiple columns. Maybe that it'll be a good foundation to what I'm looking for.
Thanks!
Sub Check_Column_Ac()
'Modified 2/3/2022 3:33:09 PM EST
Application.ScreenUpdating = False
Dim i As Long
Dim Lastrow As Long
Lastrow = Cells(Rows.Count, "AC").End(xlUp).Row
For i = 1 To Lastrow
If InStr(Cells(i, "AC"), "ECP") Then
Cells(i, "D").Value = "Valid"
Cells(i, "E").Value = "Correct"
End If
Next
Application.ScreenUpdating = True
End Sub
New to VBA. I have a large set of data that I need to go through. Now I am filtering multiple columns to see if it contains certain text, then entering value into 2 columns. So I'm looking for a macro that can search multiple columns for a pre-determined value and if present, then display texts in 2 columns. For example: If cells in column A contain "ADJ" then show "NO" in AB and "REASON" in AC & if cells in column S contain "CORP" then show "YES" in column AB and "REASON" in column AC. There are more columns that I need to search through but I'm not going to list them all so it'd be nice if I can apply this to maybe 4 columns.
I've found a code by @My Aswer Is This that works on one column but I'm not able to figure out how to edit the code so that I can use it on multiple columns. Maybe that it'll be a good foundation to what I'm looking for.
Thanks!
Sub Check_Column_Ac()
'Modified 2/3/2022 3:33:09 PM EST
Application.ScreenUpdating = False
Dim i As Long
Dim Lastrow As Long
Lastrow = Cells(Rows.Count, "AC").End(xlUp).Row
For i = 1 To Lastrow
If InStr(Cells(i, "AC"), "ECP") Then
Cells(i, "D").Value = "Valid"
Cells(i, "E").Value = "Correct"
End If
Next
Application.ScreenUpdating = True
End Sub