cmcclamroch
New Member
- Joined
- Jan 30, 2015
- Messages
- 2
I would like to know the easiest way to paste a formula while recording a macro -
I have tried referencing the formula from another cell and pasting it in that way and it does not work.
Also tried pasting from text file which does not work either. I've tried various methods from other threads on this site with similar issues and none of them work.
I have tried to enter the following into the macro but it is not working for me either... I get a compile syntax error.
Sub test()
Range("Cell Reference").Formula = "Formula Here"
End Sub
The formula works when I paste it into excel from notepad, but for some reason it won't work if I try to paste it into the macro - here is the formula.
=IF(K2<=DATE(2014,5,31),12,IF(K2<=DATE(2014,6,30),14,IF(K2<=DATE(2014,7,31),13,IF(K2<=DATE(2014,8,31),12, IF(K2<=DATE(2014,9,30), 11,IF(K2<=DATE(2014,10,31),10,IF(K2<=DATE(2014,11,30),9,IF(K2<=DATE(2014,12,31),8,IF(K2<=DATE(2015,1,31),7,IF(K2<=DATE(2015,2,28),6,IF(K2<=DATE(2015,3,31),5,IF(K2<=DATE(2015,4,30),4,IF(K2<=DATE(2015,5,31),3,"see notes")))))))))))))
I'm obviously doing something wrong
I have tried referencing the formula from another cell and pasting it in that way and it does not work.
Also tried pasting from text file which does not work either. I've tried various methods from other threads on this site with similar issues and none of them work.
I have tried to enter the following into the macro but it is not working for me either... I get a compile syntax error.
Sub test()
Range("Cell Reference").Formula = "Formula Here"
End Sub
The formula works when I paste it into excel from notepad, but for some reason it won't work if I try to paste it into the macro - here is the formula.
=IF(K2<=DATE(2014,5,31),12,IF(K2<=DATE(2014,6,30),14,IF(K2<=DATE(2014,7,31),13,IF(K2<=DATE(2014,8,31),12, IF(K2<=DATE(2014,9,30), 11,IF(K2<=DATE(2014,10,31),10,IF(K2<=DATE(2014,11,30),9,IF(K2<=DATE(2014,12,31),8,IF(K2<=DATE(2015,1,31),7,IF(K2<=DATE(2015,2,28),6,IF(K2<=DATE(2015,3,31),5,IF(K2<=DATE(2015,4,30),4,IF(K2<=DATE(2015,5,31),3,"see notes")))))))))))))
I'm obviously doing something wrong