Hi,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o></o>
<o></o>
Is it possible to store a formula in a cell and then ref to that cell in the macro code, instead of hard coding the formula into the macro. <o></o>
<o></o>
Very simply, I want to use a variation of the following code to populate a table, but rather than have to look up the formula within the code to make changes, I would like it taken from a cell, where it is more visible. That is store the sumproduct formula below in, say, the cell B1 and refer to B1 in the code.<o></o>
<o></o>
Sub Macro1()
Dim i As Integer
For i = 3 To 14<o></o>
Cells(i, 2).FormulaR1C1 = "=SUMPRODUCT((Validity=RC[-1])*(In=1)*(Out=1))"
Cells(i, 2).Value = Cells(i, 4).Value
Next i<o></o>
End Sub <o></o>
<o></o>
Hope this makes sense.<o></o>
DBus
<o></o>
Is it possible to store a formula in a cell and then ref to that cell in the macro code, instead of hard coding the formula into the macro. <o></o>
<o></o>
Very simply, I want to use a variation of the following code to populate a table, but rather than have to look up the formula within the code to make changes, I would like it taken from a cell, where it is more visible. That is store the sumproduct formula below in, say, the cell B1 and refer to B1 in the code.<o></o>
<o></o>
Sub Macro1()
Dim i As Integer
For i = 3 To 14<o></o>
Cells(i, 2).FormulaR1C1 = "=SUMPRODUCT((Validity=RC[-1])*(In=1)*(Out=1))"
Cells(i, 2).Value = Cells(i, 4).Value
Next i<o></o>
End Sub <o></o>
<o></o>
Hope this makes sense.<o></o>
DBus