Hi
I have a problem using the function Indirect within VBA. I am trying to insert the formula below using VBA. I know why I have the problem. The apostrophes are causing the formula to comment out. I don't know how to get around this if you can at all.
I have tried replacing the apostrophe with a different character to then find and replace later, I could not get this to work. the sheet name in in Cell ("C4") and I then reference it in the formula to get the result.
There does not seem to be indirect within VBA.
I don't really know another way I can return the result using adifferent method.
Thanks as usual for your help, this seems simple but I been pondering this for over a day now and need direction.
Partjob
I have a problem using the function Indirect within VBA. I am trying to insert the formula below using VBA. I know why I have the problem. The apostrophes are causing the formula to comment out. I don't know how to get around this if you can at all.
I have tried replacing the apostrophe with a different character to then find and replace later, I could not get this to work. the sheet name in in Cell ("C4") and I then reference it in the formula to get the result.
There does not seem to be indirect within VBA.
I don't really know another way I can return the result using adifferent method.
Code:
Sheet1.Range("E7").Formula = "=IF(C4="",TODAY()-1,INDEX(INDIRECT("'" & C40 & "'!$A$5:$BC$43"),MATCH(A4,INDIRECT("'" & C4 & "'!$A$5:$A$43"),0),49))"
Partjob