Mayanwolfe
New Member
- Joined
- Jun 5, 2013
- Messages
- 27
Hello,
As part of a larger macro, I'm trying to input a formula into a range of cells. This formula does an indirect lookup of a worksheet name as a tab name, and therefore requires single quotes. However, VBA keeps trying to interpret the first single quote as a comment, and therefore commenting out the rest of the formula. I've tried using Chr(39) instead, but it still gives me run time error 1004. How can I reformat this formula to make it work within the macro, and still paste correctly into the cell range?
=IFERROR(IFNA(VLOOKUP(E11,INDIRECT("'"&$D11&"'!"&"$E$10:$S$120"),15,FALSE),VLOOKUP(E11,INDIRECT("'"&$D11&"'!"&"$D$10:$S$120"),16,FALSE)),0)
Thank you for any help.
As part of a larger macro, I'm trying to input a formula into a range of cells. This formula does an indirect lookup of a worksheet name as a tab name, and therefore requires single quotes. However, VBA keeps trying to interpret the first single quote as a comment, and therefore commenting out the rest of the formula. I've tried using Chr(39) instead, but it still gives me run time error 1004. How can I reformat this formula to make it work within the macro, and still paste correctly into the cell range?
=IFERROR(IFNA(VLOOKUP(E11,INDIRECT("'"&$D11&"'!"&"$E$10:$S$120"),15,FALSE),VLOOKUP(E11,INDIRECT("'"&$D11&"'!"&"$D$10:$S$120"),16,FALSE)),0)
Thank you for any help.