简体   繁体   中英

Insert formula using VBA

The below vba code fails to insert the formula into the cell. Cell E3 contains 25,208.70 - 15,685.60. Expected outcome is 25,208.70. I do get the expected answer if the formula is inserted into the cell BJ3 but fails to insert the formula using VBA.

Please help!

Range("BJ3").Formula = "=VALUE(TRIM(LEFT(E3, FIND(" - ", E3) - 1)))"

Please, try:

Range("BJ3").Formula = "=VALUE(TRIM(LEFT(E3, FIND("" - "", E3) - 1)))"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM