lucasr48
lucasr48

Reputation: 33

Excel VBA Formula not calculating

I am trying to place a formula into the databodyrange of a table. However after the first row the formula is just placed into the cell and not calculated. It displays to formula as text.

I can even just click into the cell, press "Enter", and then it will calculate perfectly.

The cell format is correctly set to percentage. Calculations are set to automatic.

my code is as follows

If i = 0 Then
    Set LastRow = DeviceTable.ListRows(1)
Else
    Set LastRow = DeviceTable.ListRows.Add
End If
LastRow.Range(3).Formula = formula
LastRow.Range(3).NumberFormat = "0%"

enter image description here

Upvotes: 0

Views: 124

Answers (1)

lucasr48
lucasr48

Reputation: 33

I found that making it a percentage first, then adding the formula solved my problem.

Upvotes: 1

Related Questions