jmthompson
Well-known Member
- Joined
- Mar 31, 2008
- Messages
- 966
I am building a macro that includes the following lines:
I want to enter a formula in one cell which takes the value of the cell two rows above and subtracts the value in the cell two rows above and one column to the left. Since the location of these cells/rows will constantly change, I thought I'd use and offset function, but I'm doing something wrong.<SCRIPT language=JavaScript src="http://www.interq.or.jp/sun/puremis...[/XD][XH][/XH][/XR][/RANGE][/XH][/XR][/RANGE]
Code:
Cells(lastRowWFO + 20, "E").Formula = "=(Activecell.Offset(-2,0) - Activecell.Offset(-2,-1))"
Cells(lastRowWFO + 20, "G").Formula = "=(Activecell.Offset(-2,0) - Activecell.Offset(-2,-1))"
I want to enter a formula in one cell which takes the value of the cell two rows above and subtracts the value in the cell two rows above and one column to the left. Since the location of these cells/rows will constantly change, I thought I'd use and offset function, but I'm doing something wrong.<SCRIPT language=JavaScript src="http://www.interq.or.jp/sun/puremis...[/XD][XH][/XH][/XR][/RANGE][/XH][/XR][/RANGE]