amkerchner
New Member
- Joined
- May 23, 2007
- Messages
- 10
I would like to add a button on the first page of my workbook that does an update on a later sheet. I have found when I run the macro it will "paste" what ever the last thing I copied instead of the formula I would like it to paste. Because I am at a primitive stage in my macro writing I am still using the "record" feature and then editing the macro manually. Is there a way to type in the formula into the command so that each time I run the macro it will insert the same function into the cell/column?
The formula is as follows:
=IF(ISERROR(IF(AND(D2=D3,D3=D4,D4=D5),((I2*J2+I3*J3+I4*J4+I5*J5)/SUM(J2:J5)),(IF(AND(D2=D3,D3=D4),((I2*J2+I3*J3+I4*J4)/(SUM(J2:J4))),IF(D2=D3,((I2*J2+I3*J3)/(SUM(J2,J3))),I2))))),"",(IF(AND(D2=D3,D3=D4,D4=D5),((I2*J2+I3*J3+I4*J4+I5*J5)/SUM(J2:J5)),(IF(AND(D2=D3,D3=D4),((I2*J2+I3*J3+I4*J4)/(SUM(J2:J4))),IF(D2=D3,((I2*J2+I3*J3)/(SUM(J2,J3))),I2))))))
And I need it to run each time I click the button I've made. Any suggestions? I am attempting to take the weighted average of cost when there is a repeated number in column D.
The formula is as follows:
=IF(ISERROR(IF(AND(D2=D3,D3=D4,D4=D5),((I2*J2+I3*J3+I4*J4+I5*J5)/SUM(J2:J5)),(IF(AND(D2=D3,D3=D4),((I2*J2+I3*J3+I4*J4)/(SUM(J2:J4))),IF(D2=D3,((I2*J2+I3*J3)/(SUM(J2,J3))),I2))))),"",(IF(AND(D2=D3,D3=D4,D4=D5),((I2*J2+I3*J3+I4*J4+I5*J5)/SUM(J2:J5)),(IF(AND(D2=D3,D3=D4),((I2*J2+I3*J3+I4*J4)/(SUM(J2:J4))),IF(D2=D3,((I2*J2+I3*J3)/(SUM(J2,J3))),I2))))))
And I need it to run each time I click the button I've made. Any suggestions? I am attempting to take the weighted average of cost when there is a repeated number in column D.