Excel VBA formula as text issue -


in excel 2016 vba have code:

range("m2").select activecell.formular1c1 = "=iferror(if(e2=""sgl"",k2,l2),"")" 

when gets placed in cell formula not result. manually fix have change text general , actual code needs changing:

cell m2 says: =iferror(if(e2="sgl",k2,l2),") should say: =iferror(if(e2="sgl",k2,l2),"") " @ end before closing parenthesis

this recorded (i removed rc absolute cell reference when wouldn't work), i'm not sure caused or how resolve it. appreciated. thanks

i think need add quote @ end. because quote denotes string, need make 2 of them yield 1 -- means need 4 yield two.

range("m2").formula = "=iferror(if(e2=""sgl"",k2,l2),"""")" 

other notes of interest:

  • you don't need range().select , work against activecell. invoke methods/properties directly on range object
  • i think in case formula work. r1c1 handy when formulas relative, in case, referencing actual cells. there nothing wrong did, fyi

Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -