Help Required.

G

Guest

Guest
Is it possible to dynamically create a function in a cell?

I know that it is possible to do this for simple functions such as:

ActiveCell.FormulaR1C1 = "=COS(8)"

will set the cell to =COS(8)

However, I would like to make cell A2 contain the function:

=LOOKUP(A1,'[MyFile.xls]AllSites'!$A$4:$A$15,'[MyFile.xls]AllSites'!$B$4:$B$15)

Where I control MyFile.xls via a variable or another cells contents.

I have been able to make the cell contents equal the following TEXT:

"LOOKUP(A1,'[MyFile.xls]AllSites'!$A$4:$A$15,'[MyFile.xls]AllSites'!$B$4:$B$15)"

where MyFile.xls is actually the contents of another cell.
However, this is just text as there is no '=' sign to make it a function.

I can manually select the cell and add the '=' sign and it will work as I want it. Unfortunately, i can't seem to do this automatically.

Any bright ideas people?

Many Thanks.
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.

Forum statistics

Threads
1,214,653
Messages
6,120,750
Members
448,989
Latest member
mariah3

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