Hiding secret formulas

H

HappySenior

Kentucky Fried Chicken, Coca-Cola, etc. have secret trade formulas. Is
there a way to securely hide a secret formula?
I want to create a function (macro) that when applied to a particular
cell will compute a value based on variable elements of a spreadsheet
as multiplied by undisclosed fixed elements.

Example: Assume a1,b1, c1 and d1 have variables. Also assume that the
fixed elements are fe1=.4,fe2=.25,fe3=.11,fe4=.24 stored in the
function I created called rating.

Thus, cell e1 =(function) rating(a1,b1,c1,d1) and yields the result of
(a1*fe1)+(b1*fe2)+(c1*fe3)+(d1*4).

Is there a way to hide the declaration of a function or must the
function be declared in another language where it MIGHT be more
secure? The use of another language would seem to raise issues like
impact on speed.

Is it possible to create the function and disable macros to conceal
the process to all but the most knowledgeable Excel users?

A newbie at writing macros, any help provided will be appreciated...
 
P

Peter T

Here's one way

First select cell E1
Define a named formula, ctrl-F3
Name: myFunc
RefersTo: =(A1*FE1)+(B1*FE2)+(C1*FE3)+(D1*4)

in cell E1, =myFunc()

check the formula is OK

Now to hide it from all but mid level plus VBA'ers

in the VBE, Alt-F11, open the Immediate Window, ctrl-g, paste the following

activeworkbook.Names("myFunc").Visible = False

with the cursor at the end of the line hit enter (back in Excel look at the
names dialog ctrl-F3)

Note the named formula is relative to the cell that was selected when you
named it. My guess is you will want a combination of relative and absolute
addresses in the named formula (that is if you want to use myFunc elsewhere)

Regards,
Peter T

PS, when you want to see the named formula again change the False to True
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top