How do you set the formula of a specific cell in a table? I have a table (tblPO
) with columns Unit Price
, List Price
and Disc.
. I need to loop through the rows of the table checking whether the Disc.
column of each row contains a value, and if it does, the formula of the Unit Price
of that row needs to be set to the List Price
minus the Disc.
Here’s what I have so far to loop through the table and check whether the Disc.
has a value or not:
For I = 1 To Range("tblPO[#Data]").Rows.Count
If [tblPO].Cells(I, [tblPO[Disc.]].Column) <> vbNullString Then
<Unit Price cell formula> = "=[@[List Price]]*(1-[@[Disc.]])"
End If
Next I