Eval function help

davei

New Member
Joined
Aug 18, 2011
Messages
4
Hello

I am using the following VBA script to show formulae in calculations:

Code:
Public Function Eval(S As String)
    Eval = Evaluate(S)
End Function

No matter what I do (e.g. include application.volatile) I always get the #NAME? error after I change any other formula in the sheet and thus have to manually recalculate each time which is annoying.

The only thing worth noting is I have lots of named cells e.g. a formula in cell B6 might be
s_es*A_t*E_c
and then the cell adjacent uses eval(B6)

the definitions of the name s_es is also using the eval function, so wondering if eval(x) of an eval(y) is causing the issue?

Essentially I'm trying to use Excel as a calc pad that displays the workings when printed, so if there is a completely different way of doing this then that would also be very helpful!

Thanks in advance
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
should have also said using windows 7 64 bit and excel 2007. Not sure if that is relevant.

Cheers
 
Upvote 0
When you say "definitions of the name s_es is also using the eval function" ... that almost sounds like it isn't referring to an actual cell. Is it a cell? Or is it a calculation within a defined name?
 
Upvote 0
so say cell b6 is called "s_es". the formula within that cell is eval(a6) and then cell a6 is another string of a formula but without the "=" at the front

the defined name doens't have a calculation within it. it is literally just a named cell.
 
Upvote 0
Hello

I am using the following VBA script to show formulae in calculations:

Code:
Public Function Eval(S As String)
    Eval = Evaluate(S)
End Function

No matter what I do (e.g. include application.volatile) I always get the #NAME? error after I change any other formula in the sheet and thus have to manually recalculate each time which is annoying.

The only thing worth noting is I have lots of named cells e.g. a formula in cell B6 might be
s_es*A_t*E_c
and then the cell adjacent uses eval(B6)

the definitions of the name s_es is also using the eval function, so wondering if eval(x) of an eval(y) is causing the issue?

Essentially I'm trying to use Excel as a calc pad that displays the workings when printed, so if there is a completely different way of doing this then that would also be very helpful!

Thanks in advance
See post #2 for an alternative code for EVAL in...

http://www.mrexcel.com/forum/showthread.php?t=553863
 
Upvote 0

Forum statistics

Threads
1,224,568
Messages
6,179,572
Members
452,927
Latest member
whitfieldcraig

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