Calling a function in excel

I created a function in the Visual Basic Editor in Excel 
but am unable to call it from an individual cell in 
Excel.  I  am using "=function name(argument1, argumaent2, 
argument3)" when I try to call it. I am getting the 
error "$NAME?".  Any ideas?
0
tfreem1 (2)
12/17/2003 2:16:56 PM
excel.misc 78881 articles. 5 followers. Follow

5 Replies
573 Views

Similar Articles

[PageSpeed] 30

Hi

The function should be i a standard module (insert menu), not in a worksheet
module or anywhere else. And it must not be Private as in
"Private Function XYZ() as Long"
And you are of course entering it without the quotes ?

--
HTH. Best wishes Harald
Followup to newsgroup only please

"Tom" <tfreem1@yahoo.com> skrev i melding
news:0a7501c3c4a8$6d73c7c0$a301280a@phx.gbl...
> I created a function in the Visual Basic Editor in Excel
> but am unable to call it from an individual cell in
> Excel.  I  am using "=function name(argument1, argumaent2,
> argument3)" when I try to call it. I am getting the
> error "$NAME?".  Any ideas?


0
innocent (844)
12/17/2003 2:31:42 PM
I don't see the option insert menu.  Am I in my Excel 
spreadsheet when I create this function?
>-----Original Message-----
>Hi
>
>The function should be i a standard module (insert menu), 
not in a worksheet
>module or anywhere else. And it must not be Private as in
>"Private Function XYZ() as Long"
>And you are of course entering it without the quotes ?
>
>--
>HTH. Best wishes Harald
>Followup to newsgroup only please
>
>"Tom" <tfreem1@yahoo.com> skrev i melding
>news:0a7501c3c4a8$6d73c7c0$a301280a@phx.gbl...
>> I created a function in the Visual Basic Editor in Excel
>> but am unable to call it from an individual cell in
>> Excel.  I  am using "=function name(argument1, 
argumaent2,
>> argument3)" when I try to call it. I am getting the
>> error "$NAME?".  Any ideas?
>
>
>.
>
0
anonymous (74722)
12/17/2003 2:43:40 PM
No, in the VB editor.

For a quick test: In a blank workbook, open the VB editor (Alt F11 or similar). Go menu
Insert > Module. Paste this in it:

Function Half(D As Double) As Double
Half = D / 2
End Function

Now close the editor, return to Excel. Enter a number in cell A1. In B1 enter this:

=Half(A1)

and -in theory- it should work.

--
HTH. Best wishes Harald
Followup to newsgroup only please.

"Tom" <anonymous@discussions.microsoft.com> wrote in message
news:0a7401c3c4ac$298aff20$a401280a@phx.gbl...
> I don't see the option insert menu.  Am I in my Excel
> spreadsheet when I create this function?
> >-----Original Message-----
> >Hi
> >
> >The function should be i a standard module (insert menu),
> not in a worksheet
> >module or anywhere else. And it must not be Private as in
> >"Private Function XYZ() as Long"
> >And you are of course entering it without the quotes ?
> >
> >--
> >HTH. Best wishes Harald
> >Followup to newsgroup only please
> >
> >"Tom" <tfreem1@yahoo.com> skrev i melding
> >news:0a7501c3c4a8$6d73c7c0$a301280a@phx.gbl...
> >> I created a function in the Visual Basic Editor in Excel
> >> but am unable to call it from an individual cell in
> >> Excel.  I  am using "=function name(argument1,
> argumaent2,
> >> argument3)" when I try to call it. I am getting the
> >> error "$NAME?".  Any ideas?
> >
> >
> >.
> >


0
innocent (844)
12/17/2003 5:55:35 PM
Very clever Harald,
and coming from a Yorkshireman that is praise indeed!

Thanks


John P
"Harald Staff" <innocent@enron.invalid> wrote in message
news:udnCqaMxDHA.3416@tk2msftngp13.phx.gbl...
> No, in the VB editor.
>
> For a quick test: In a blank workbook, open the VB editor (Alt F11 or
similar). Go menu
> Insert > Module. Paste this in it:
>
> Function Half(D As Double) As Double
> Half = D / 2
> End Function
>
> Now close the editor, return to Excel. Enter a number in cell A1. In B1
enter this:
>
> =Half(A1)
>
> and -in theory- it should work.
>
> --
> HTH. Best wishes Harald
> Followup to newsgroup only please.
>
> "Tom" <anonymous@discussions.microsoft.com> wrote in message
> news:0a7401c3c4ac$298aff20$a401280a@phx.gbl...
> > I don't see the option insert menu.  Am I in my Excel
> > spreadsheet when I create this function?
> > >-----Original Message-----
> > >Hi
> > >
> > >The function should be i a standard module (insert menu),
> > not in a worksheet
> > >module or anywhere else. And it must not be Private as in
> > >"Private Function XYZ() as Long"
> > >And you are of course entering it without the quotes ?
> > >
> > >--
> > >HTH. Best wishes Harald
> > >Followup to newsgroup only please
> > >
> > >"Tom" <tfreem1@yahoo.com> skrev i melding
> > >news:0a7501c3c4a8$6d73c7c0$a301280a@phx.gbl...
> > >> I created a function in the Visual Basic Editor in Excel
> > >> but am unable to call it from an individual cell in
> > >> Excel.  I  am using "=function name(argument1,
> > argumaent2,
> > >> argument3)" when I try to call it. I am getting the
> > >> error "$NAME?".  Any ideas?
> > >
> > >
> > >.
> > >
>
>


0
jp1 (93)
12/17/2003 7:50:57 PM
"John Proud" <jp@jpwebs.co.uk> wrote in message
news:OPt#ZcNxDHA.2708@TK2MSFTNGP09.phx.gbl...
> Very clever Harald,
> and coming from a Yorkshireman that is praise indeed!

Thanks John ;-)
Best wishes Harald



0
innocent (844)
12/17/2003 9:04:45 PM
Reply:

Similar Artilces:

Call in?
Do new owners of Office X have to call up Microsoft to register their copy? If yes, what's the number? thanks. Ming <asdf@asdf.com> wrote: > Do new owners of Office X have to call up Microsoft to register their > copy? If yes, what's the number? thanks. Nope. We're not using Windoze :->>> This version does not require activation. Corentin -- - Mac:MS MVP (Francophone) - (MS) MVP: http://support.microsoft.com/default.aspx?ln=FR&scid=fh;FR;mvp Newsgroups produits MS: http://support.microsoft.com/newsgroups/?ln=FR ...

How do you do a strike out in an Excel cell?
How do you do a strike out in an Excel cell? Format | Cells... | Font | Effects = strikethrough Regards Trevor "dgalati" <dgalati@discussions.microsoft.com> wrote in message news:4364AE43-F016-45B3-A6ED-160A405B3291@microsoft.com... > How do you do a strike out in an Excel cell? ...

Formatting exponentials in Excel
I am trying to set up a spreadsheet that has a formula for the available space which is = total - used The thing is the space is GB or MB (1x10^9 or 1x10^6) I formatted the numbers to display 1000000 as 1.00E+06 but is there anyway of making this into 1MB so it will still calculate correctly? Hope that makes sense, Thanks, Niall. Custom format #,,\M\B OR #.#,,\M\B OR #.0,,\M\B OR 0.0,,\M\B -- HTH, RD ===================================================== Please keep all correspondence within the Group, so all may benefit! ===================================================== "N...

Covered Call Options
Hello all, I do I go about dealing with a covered call transaction in Microsoft Money 2007 Premium? Currently what I am doing is inputing the option symbol, and choosing the transaction "Sell to Open" then when I go to expire the option I try to do a Sell to Close. However it does not seem to work? Also what happens if instead of expired I has the position assigned? how would I account for that? Thank you. Shhhh In microsoft.public.money, Shhhh wrote: > >I do I go about dealing with a covered call transaction in Microsoft >Money 2007 Premium? Currently what I am doing is...

Call center tracking and reporting
Anyone use CRM 4.0 for call tracking? Our Sales/Marketing is set up. Now I need to decide how to most efficiently customize CRM 4.0 for our company's call tracking portion. Can someone send me a link to information? thanks ...

MAXA worksheet function
The functions MAXA and MINA appeared when I upgraded to Excel 2003. When I use them in a worksheet & try to save the result, I receive a message saying that these functions cannot be converted to the file format that I am using. The file format that I am using gives Excel 97, 2003, NT, 5.0 and 95. What am I doing wrong? Thanks! IIRC, MINA and MAXA appeared in XL97, so saving to XL5/95 compatible format won't work. Is there any reason you need to save in that format? It makes your workbook twice the size of saving it as an XL workbook (e.g., 97/03 format) since it saves both for...

Excel VBA Question
Ok, I am stuck trying to write a function to do the following, and it would be greatly appreciated if someone could help me. I have two columns, one of data, and another of dates. I need to write a function that filters by dates, and counts the total number of items For Example: My data (column 1) has Members, Non_Members, and Other. My Dates (Column 2) have, well, dates. I have a report sheet that I need to report the numbers. So in the report for each data type (Member, Non_Member, Other) I want to be able to use function (=blah(date I am filtering for less than or equal to)) an...

telephone calls
when placing a telephone call using outlook, everything works fine except I can't hear the person i am talking to. They can hear me find. When I use a telephone program not associated with outlook every thing works great. can someone help ...

Date Function #2
This is a multi-part message in MIME format. ------=_NextPart_000_0022_01C6152B.8E758000 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Is there an easy way to compute the number of days in a certain month = between a starting and ending date? For example, how should I compute = the total number of days in March between two given dates? ------=_NextPart_000_0022_01C6152B.8E758000 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Trans...

Excel Attachment Opening Problem in Outlook 2000
I have several users who have lost the ability to open Excel attachments from Outlook. When the users click on the Excel attachment, the Excel shell opens and the error message state that 'access to the specified device, path or file denied.'. Additionally, if the users attempt to save the file to his/her hard drive, he/she gets the error message that 'the system cannot find the file specified.'. Users are able to open all other types of Office 2000 files, i.e., Word, Powerpoint, and Access files. If anyone can help me with this issue or clue me in on how to find ...

Macro is Excel to populate a word document #2
Guys, I appreciate if you could help me do the following: I have a table of data in excel and need to be able to click a button in excel that will run a macro and send that data to a word document (In the form of a table) Thats it Thanks a lot Andrew ...

excel online
Hi, How can I put an excel xls on the webserver so that I can use IE to click and fill up the information and then click a button to send an email to a default sender? Please advise me the methodology. Thanks. ...

Excel construct single chart from 2 charts
Hello All, Anyone an idea how to construct such a chart in Excel? http://chart.yahoo.com/c/5y/p/pdli.gif I know you can build more then one chart into one chart sheet but what i really want to do is construct one chart or 2 chart objects assembled into 1 so they can be exported into 1 gif as per above looked at the charting samples at the John Peltier site but still got no idea how to construct this TIA Brian Brian - The way I've done this is by embedding two chart objects in a blank chart sheet. A little VBA to make sure the chart axes line up. Then the chart sheet is exported. -...

Insert spinning button with time format in Excel 2000?
I am making a form template in Excel 2000. Every time I try to enter a spinner button I can't get it to work with time format. I want the time to be between 00:00 and 24:00 with 15 minute increments. I've tried with and without the colons but nothing is working. I put a spinner from the Forms toolbar on a worksheet. I rightclicked on it and chose format control. On the control tab, I used: Minimum value: 0 maximum value: 96 Incremental change: 1 And cell link A1 Then in B1, I put: =a1/96 and formatted as time: hh:mm 96 is the number of 15 minute increments in a day (4*24...

Closing Excel 2000 from VB (Unwanted process EXCEL.EXE)
I have an Access database - it uses the following code to open Excel Public Sub OpenXlSheet(strReportName As String) ' Check if excel is open, close it if it is If AppInUse("xlmain") <> 0 Then Dim objExcel As Excel.Application Set objExcel = GetObject(, "Excel.Application") objExcel.Quit Set objExcel = Nothing Do While AppInUse("xlmain") <> 0 Loop End If 'open a fresh excel application and load strReportName Set objExcel = CreateObject("Excel.Application") objExcel.Appl...

very slow to open excel file
hello, my computer in office is using WIN 98 SE, i found that it's too slow to open an excel file recently. please help thanks a lot Hi Alex! Most probable causes are: Too much accumulated junk in: C:\Windows\Temp File Shut down your computer and re-start. Then delete all contents of the C:\Windows\Tem file Alternative might be a bloated Excel.xlb file. Locate the Excel.xlb or Excel10.xlb file using Start > Search > For Files and Folders. The xlb file should not be above around 30kb and is usually much smaller. If it is bloated, there's not a lot that can be done w...

Calling Macro
Hi All, I have macro like this sub unique() '''''''' '''''''' Counter_item = 0 For Each Item In nodups counter_item = counter_item + 1 bic_var = Item Call Ps_Match Next Item end sub I have another macro Sub Ps_Match() ''''' ''''' If counter_item <= 1 Then call another_macro() end if end sub In the first macro i am declaring counter_item equals to 1. In my second macro i need to call that number. At the to of the module put: Public Counter_I...

How do I change office assistant in Excel 2002
How do I change office assistant in Excel 2002 Show the assistant, right click and select 'choose assistant' -- Regards Ken....................... Microsoft MVP - Excel Sys Spec - Win XP Pro / XL 97/00/02/03 ---------------------------------------------------------------------------- It's easier to beg forgiveness than ask permission :-) ---------------------------------------------------------------------------- "Adele" <Adele@discussions.microsoft.com> wrote in message news:D4A13539-D428-4B9D-8A81-339ECA10BDC4@mi...

Excel Calculator always requires an = before a math function, can be turned off setting?
I often use excel as a fancy calculator. But often I forget to start the calculator with the = sign. So if I want to add 44 + 66, I forget to type in an = sign first, an it gives me an error message. Is there a setting to turn that off, so I can type in 44 + 66 and it gives me an answer. I always have Excel running and it's also my calculator. I never use use a calculator anymore! The answer to your question is no. The equal sign tells Excel that you're entering a formula that needs to be calculated. You can use a plus sign (+) instead of the equal sign (=) if you alwa...

Disabling automatic send function
I used to be able to have messages in my Outbox sit there till I hit send/receive by checking "disable send/receive" on the tools menu. For some reason, disabling send/receive now only disables the automatic receive function. My emails in my Outbox are sent automatically, as soon as they hit the outbox. I send monthly emails to my contacts thru the mail merge program in Word. I then go to my Outbox to attach a document to them. It used to be that if I disabled the automatic send/receive function in the tools menu, the messages in my outbox would sit there so I could add ...

Plotting functions
I am brand new to using the charting feature of Exel and am having trouble with what should be a simple operation. I want to create a graph of y=f(x) -- say for simplicity's sake f(x) = x^2. I have in column A, for x, the numbers -10 through +10 and in column B =A^2. Column B shows the correct values but have not been able to create the pretty graph I know so well. Would someone give me a bit of help here? Thank you very much. Where do you get stuck? Select the data range, click the Chart Wizard. In step 1 select the XY Scatter chart. That should give you what you want. ...

How to use formulas in Excel to control the text color ?
For example, I want to use a formula to show a green "Pass" when the value>=60 else a red "Fail". So I use "IF(C3<60,"Fail","Pass")" to show the text, but I can not control the color, can anyone tell me, how to change text color in the formula ? Thanks in advance. Have a look at Conditional Formatting. It will do exactly what you are looking for. -- Ken Russell kenrussellyourhat@optushome.com.au Remove yourhat to reply by e-mail .. "Jackie Cao" <Jackie Cao@discussions.microsoft.com> wrote in message news:5A79333...

Workflow -Assembly Call
How does add subtract in the Workflow>> assembly call works. I do understand that ypu can write your own custom workflows, register it and then call them from here, but I am pretty confused with the existing functionality. workflows can call other workflows workflows can also call a method in a .net assembly. ie you could write a piece of code in c# or vb.net and then have the workflow call your code. ======================= John O'Donnell Microsoft CRM MVP http://codegallery.gotdotnet.com/crm "SAM" <SAM@discussions.microsoft.com> wrote in message news:DE...

Async calls to WebService in MFC
Hey guys, I use a webservice over the net which is scripted in VB.Net. This web service receives a username and a password and returns a string structure with multiples infos. If the string is empty, I had the wrong username and/or password. Pretty simple isn't? Ok now the problem is a bit more complex. I'm using an MFC client to connect to these web services, and since they're on the internet, there's a delay between sending the data and receiving an answer. I don't know really how I can tell me client to "wait for the string". The wrapper MFC created for the w...

Converting from works to Excel
I received a file that was created in works and I can't open it with Excel 2000 (of course) Is there a way to accomplish this? Generally you would normally open the file in WORKS and then save it down as a file that Excel can read. .xlr is a native Excel format, or .txt, .csv, dbaseIV are all formats it can read. You can also find a converter here if you don't have WORKS. http://www.rl-software.com/indexjs.htm?/converter/wkscnvxls_e.htm Text from the website above:- Microsoft does not provide an import Excel filter for Works-WKS files later than version 2. (for Works-WPD and W...