0
votes

I get this type mismatch (Error 13) when I try to run the script. Below is the code highlighted error. I'm trying to enter this formula with VBA into the cell but I got an error.

TopVisibleCell.Formula = _
 "=IF(ISERROR(LEFT(I2,SEARCH( " - " ,I2)-1)),I2,LEFT(I2,SEARCH( " - " ,I2)-1))"
1
I would advice you to break up formula in small pieces and check exactly where you are getting error - DevelopmentIsMyPassion

1 Answers

0
votes

You need to escape " in VBA with ""

TopVisibleCell.Formula = _ 
"=IF(ISERROR(LEFT(I2,SEARCH("" - "",I2)-1)),I2,LEFT(I2,SEARCH("" - "",I2)-1))"