EXCEL - VBA Keeps Adding a Space in my Formula

Viewed 38

I have been trying to automate my spreadsheet where each cell removes all characters before the symbol ">". The formula I am using works when I input into the spreadsheet manually which returns all the information I need after the symbol ">" . However when inputting this into VBA It keeps adding a space to both sides of the symbol " > " and the result now displays "TRUE". I was reading that the formula may need double quotes but when adding double quotes "">"" the formula does not work. Any help is appreciated. Thank you!

Formula

=IFERROR(MID(D2,SEARCH(">",D2)+2,2000),D2)

Formula when entered into VBA - (Space Gets Added)

Range("E2").Formula = "=IFERROR(MID(D2,SEARCH(" > ",D2)+2,2000),D2)"
1 Answers

you will have to add an extra pair of double quotation marks within the ones you have in your formula. So you would end up with =IFERROR(MID(D2,SEARCH("">"",D2)+2,2000),D2)

Related