Hi All
Can you please help with a problem I am having with some VBA code. As part of the macro I want the code to enter a formula into a cell. The formula is fairly simple, just saying.....if cell A36 is blank then return blank, else if cell A36 is less than or equal to Today's Date then return the latest Position cell reference.
However, writing the formula in this way in the code returns 'FALSE' in the cell because of the way the code interprets all the ""s. Am I just being stupid as I can't quite get this to work? I'm sure it should be quite easy, but I can't quite work out how to write it so that it works.
Thanks for your help
Simon
Can you please help with a problem I am having with some VBA code. As part of the macro I want the code to enter a formula into a cell. The formula is fairly simple, just saying.....if cell A36 is blank then return blank, else if cell A36 is less than or equal to Today's Date then return the latest Position cell reference.
However, writing the formula in this way in the code returns 'FALSE' in the cell because of the way the code interprets all the ""s. Am I just being stupid as I can't quite get this to work? I'm sure it should be quite easy, but I can't quite work out how to write it so that it works.
Code:
LastPosition = Activecell.Address(False, False)
[B]Worksheets("Position").Range("F37").Formula = "=if('Date!'A36="","",if('Date!'A36<=Today,0,'Date!"' & LastPosition & "))"[/B]
Thanks for your help
Simon