Thought this was simple, but keep getting errors.
Pasting into N1 works fine. So does G1, but the line pasting into G2 causes a 1004. Any ideas why?
I also tried using FormulaR1C1 and assigning the formula (=IF(A2=$N$1,"",IF(G1="","",A2))) to a string variable, then pasting that. All of these error out. Manually typing the formula in works fine.
Pasting into N1 works fine. So does G1, but the line pasting into G2 causes a 1004. Any ideas why?
I also tried using FormulaR1C1 and assigning the formula (=IF(A2=$N$1,"",IF(G1="","",A2))) to a string variable, then pasting that. All of these error out. Manually typing the formula in works fine.
VBA Code:
Sheets("Data1").Range("N1").Value = "****PERIOD TO DATE****"
Sheets("Data1").Activate
Range("G1").Value = "=IF(A1="","",A1)"
Range("G2").Value = "=IF(A2=$N$1,"",IF(G1="","",A2))"
Range("G2").Copy
Range("G3:G1000").PasteSpecial xlPasteFormulas