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

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

davei

New Member
Joined
Aug 18, 2011
Messages
4
should have also said using windows 7 64 bit and excel 2007. Not sure if that is relevant.

Cheers
 

GlennUK

Well-known Member
Joined
Jul 8, 2002
Messages
11,547
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?
 

davei

New Member
Joined
Aug 18, 2011
Messages
4
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.
 

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,209
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
 

Forum statistics

Threads
1,144,629
Messages
5,725,384
Members
422,622
Latest member
Paranthem

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
Top