I am trying to create a "If statement" where I check column B if it contains a partial string ("BMC-"). Then write "Bill of Material" in column E.
I already have tried using a formula, but I would like this to written as a macro.
=IF(ISNUMBER(SEARCH("BMC-",B14)), "Bill of Material", "")
Sub Descriptions()
For r = 14 To Cells(Rows.Count, "B").End(xlUp).Row ' From row 1 to
the last row with data
On Error Resume Next
If Cells(r, "B") = "BMC-9" > 0 Then
Cells(r, "E").Value = "Bill of Materials"
End If
Next
End Sub
I am wanting the code to loop until the last row to find all the strings that contains the partial text "BMC-" in column B to write "Bill of Materials" in column E
If Cells(r, "B").Value Like "*BMC-*" ThenOn Error Resume Nextas well. If there is an error, you will want to define an error handler.