Share via

How do I solve #NAME error with my vba code?

Anonymous
2013-11-10T15:33:20+00:00

What is the script? VBA? I can't help without knowing more details. If VBA, what is the script? Please post it.

I just created 5 VBA function macros using Excel 2011 on my Mac OSX 10.8.5. When I try to invoke any of them I get the "#NAME?" response, which, I assume from forum postings, is caused by macros being disabled. On re-opening my worksheet, saved as .xls, I was asked if I wanted to enable macros (answered "yes"), but still get that response. Any assistance appreciated.

Here they are:

Function Kelvin(tempC)

    Kelvin = tempC + 273.15

End Function

Function ArrhEa(Ea, Intercept, tempC)

    Arrhenius = Intercept * exp(Ea / (8.3144 * Kelvin(tempC)))

End Function

Function AgingTime(res, coef, exp)

    ' calculate aging time given resistance and power law parameters

    AgingTime = Power(coef, 1 / exp) * Power(res, -1 / exp)

End Function

Function AgedRes(time, coef, exp)

    'Calculate resistance from aging time

    AgedRes = coef * Power(time, exp)

End Function

Function ActEnergy(L1, L2, TC1, TC2, Ea, L0)

    'Activation energy and intercept value of Arrhenius equation

    Ea = 8.3144 * (L1 / L2) / (1 / Kelvin(TC1) - 1 / Kelvin(TC2))

    L0 = L1 * exp(8.3144 * Kelvin(TC1) / Ea)

End Function

[New question split by volunteer moderator from this answered question.

 I can't find the Trust Center in Excel Mac - Microsoft Community

The moderator, who tried to get the essence of the question, supplied the title of the new question. The asker of the question may change the title by editing the question, and the moderator will not be offended in any way.

Note from moderator: new questions get answered much faster when asked as new questions. When a new question or follow-up question is tacked onto an answered question you can only hope a moderator stumbles across it and splits it off, which can take days, or may ever happen.]

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2013-11-11T20:44:53+00:00

In addition to Bob Greenblatt's reply:

Exp is a VBA function, but Power is not.

Power is a worksheet function, so replace Power with WorksheetFunction.Power in your VBA code.

Or, instead, use the exponentiation operator ^.

  • Mike

Was this answer helpful?

0 comments No comments

3 additional answers

Sort by: Most helpful
  1. Anonymous
    2013-11-26T18:01:33+00:00

    Moved to XL2011 forum by moderator.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2013-11-11T14:22:38+00:00

    Kelvin works fine for me. I don't know exactly how you are calling these functions. But, a function returns a value to the name of the function. So, ArrEa as you defined it must have a line of code that says Arrhea=. Instead you have stated Arrhenius=.  Aging time and agedres should also be OK. You have the same issue with ActEnergy.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2013-11-11T11:51:04+00:00

    Your question was created in the 2008 section, as far as I remember it did not support macros.

    The description says excel 2011, so it should work.

    Can you provide a sample file with sample data on which you would want the macro to run.

    There are some MVP's who are great with codes, but for better help you could also post in the TechNet.

    Was this answer helpful?

    0 comments No comments