suresh7860
suresh7860

Reputation: 91

VBA - Range formula not working - if(or(isnumber(search) not working

I am not able to use this formula in vba, can you please help me with this:

Range("L2").Formula = "=IF(OR(ISNUMBER(SEARCH("CTA",K3)),ISNUMBER(SEARCH("Dissolved",K3)),ISNUMBER(SEARCH("ZBA",K3))),"Yes","No")"

When I am doing it manually its working fine but when I am trying it thru VBA I am getting error, please correct me.

I tried to look into old question but not able to match with this

Upvotes: 1

Views: 1664

Answers (1)

Alex K.
Alex K.

Reputation: 175826

That's not a valid string, the interior " must be escaped as ""

Range("L2").Formula = "=IF(OR(ISNUMBER(SEARCH(""CTA"",K3)),ISNUMBER(SEARCH(""Dissolved"",K3)),ISNUMBER(SEARCH(""ZBA"",K3))),""Yes"",""No"")"

Upvotes: 2

Related Questions