Re: VBA String for contains.
o you are my hero.. i posted another issue im having with searching in a macro.. basically i had this really long formula (see below) and i needed to add alot more criteria too it but it was telling my i couldnt add over 7 functions to a formula.. i cant recall the exact error.. so i decided to just build this macro in VBA. My question i posted is below also
Formula in excel:
=IF(ISNUMBER(SEARCH("WARN",J58)),"Warning",IF(ISNUMBER(SEARCH("PSSNAP",N58)),"Sales",IF(ISNUMBER(SEARCH("WARN",L58)),"Warning",IF(ISNUMBER(SEARCH("2699",L58)),"Warning",IF(ISNUMBER(SEARCH("4004",L58)),"Warning",IF(ISNUMBER(SEARCH("2036",L58)),"Warning",""))))))
Posted question:
It sounds simple but its really causing me problems.. Here is what I am
currently having to do..
If InStr(UCase(Range("J2").Value), "WARN") Then
Range("Q2") = "Warning"
End If
If Range("N2") = "PSSNAP" Then
Range("Q2").Select
ActiveCell.FormulaR1C1 = "Sales"
End If
Ok. This list goes on an on.. I basically have about 15 more strings like
this to add on.. Is there not away to have the macro search through the
columns and have it input my answers on the corresponding cell in column "Q"
if the data from column J/L matches what i need? I need help on this bad.
ASAP. Thanks a ton!