Can't enter formula from cell using vba

SVRouss

New Member
Joined
Sep 17, 2021
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hi All,
There is a problem depicted below. There is a cell B6 with a formula (does not matter what is the formula, a formula in principle), which is shown in cell B7 using FORMULATEXT function. Cell B8 contains this formula in the macro format obtained using the macro recorder.
Now the problem:
  • If using direct mentioning of the formula in vba procedure (Buttons Direct and Direct 1 and the corresponding macros), cell B6 returns the required value regardless the function you use (Formula, FormulaR1C1, Value, etc.)
  • If using a reference to the cell containing the formula in the right format (Buttons InDirect and the corresponding macros), cell B6 returns the value of the referenced cell but does not transform it into formula regardless the function you use (Formula, FormulaR1C1, Value, etc.) and the form of the value (c.Value ot c.Text).
  • Remark: format of all cells is General.
So the question is, how to transform formulae stored in cells into formulae using vba?
Example.png
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
Bingo! You need to store formula is direct format (ie, as =RC[-1]&"["&R[-1]C[-1]&"]"&VLOOKUP(R[-1]C,R[-5]C[-1]:R[-3]C,2,0) in this case), then x.FormulaR1C1 = c.Value works correctly.
 
Upvote 0
Solution

Forum statistics

Threads
1,223,703
Messages
6,173,973
Members
452,540
Latest member
haasro02

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