cells.value vs cells.formula

lezawang

Well-known Member
Joined
Mar 27, 2016
Messages
1,805
Office Version
  1. 2016
Platform
  1. Windows
Hi
In this code, I do not see any difference between cell.value and cells.formula when it comes to entering a formula.
They both did the same thing. Am I right? Is there any case, I have to use cells.formula instead of cells.value? Thank you very much.

Code:
Sub insert_formula()
    Cells(11, 1).Value = "=sum(a1:a10)"
    Cells(12, 1).Formula = "=sum(a1:a10)"
End Sub
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
They both work like that, however I would always use Formula when entering a formula & Value when entering a value, as I find it far more obvious what is going on, when revisiting the code at some point in the future.
 
Upvote 0
Another point, if you use .Formula & in 2 years someone asks you to change the formula, you can search for .Formula & quickly find the formula to change.
Whereas if you use .Value it will take a lot longer.
 
Upvote 0

Forum statistics

Threads
1,212,929
Messages
6,110,740
Members
448,295
Latest member
Uzair Tahir Khan

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top