Hi all.
I am trying to assign a formula to a cell, which is a if function that will assign values based on if the cell is empty or not.
The sub reset_works() is using Formula2R1C1, this one works.
However, I couldn't figure out why when I am switching to Formula, which is the sub reset_notworking(), it pumps a run-time error '1004'?
Thanks all.
I am trying to assign a formula to a cell, which is a if function that will assign values based on if the cell is empty or not.
The sub reset_works() is using Formula2R1C1, this one works.
However, I couldn't figure out why when I am switching to Formula, which is the sub reset_notworking(), it pumps a run-time error '1004'?
Thanks all.
VBA Code:
Sub reset_works()
Range("D2").Formula2R1C1 = "=IF(RC[-3]<>"""",R[-1]C[-2],"""")"
Range("D3").Formula2R1C1 = "=IF(RC[-3]<>"""",R[-2]C[-2],"""")"
End Sub
Sub reset_notworking()
ActiveSheet.Range("D2").Formula = "=IF(A2<>"";B1;"")"
End Sub