Great news...found the answer...this works: ActiveCell.FormulaR1C1 = "=""01/01/""&YEAR(TODAY())"
How do you get a formula to paste when using Macro's? I need to insert the formula ="01/01/"&YEAR(TODAY()) into B15 using a macro. Any help would be great!
Need:
Range("B15").Select
ActiveCell.FormulaR1C1 = "="01/01/"&YEAR(TODAY())"
Current:
Sheets("VOI Calculations for Primary").Select
Range("B9").Select
ActiveCell.FormulaR1C1 = "*Enter current period Social Security*"
Range("B10").Select
ActiveCell.FormulaR1C1 = "*Enter current period Medicare*"
Range("B15").Select
ActiveCell.FormulaR1C1 = "01/01/2018"
Hi Troy
You can try
ActiveCell.Formula = "=Date(Year(Today()),1,1)"
or
Range("B15").Formula = "=Date(Year(Today()),1,1)"
You don't need to select a cell before you insert the formula. Just refer to it, for e.g. Range("B15") etc
Hope this helps.
Sunny
Just to answer the specific issue you were having, you need to double up any quotes inside the actual formula, so it would be:
Range("B15").Formula = "=""01/01/""&YEAR(TODAY())"