Excel Udf Invalid Name Error
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow vba #name? error the company Business Learn more about hiring developers or posting ads with us Stack #name? excel error Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of excel vba name function 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up #NAME? error in Excel for VBA Function up vote 4 down vote favorite 2 I am making my vba function not working in excel first VBA program and trying to run the following function. The function checks a specific named range for the first row which does not have a value greater than it's leading value, but less than 1. Public Function findPurchase() Dim CRT As Range Set CRT = Range("CostRateTable") Dim existsBetter As Boolean existsBetter = True Dim r As Integer r = 2 Dim c As Integer c = 4 While existsBetter Dim Found
Excel Udf #name Error
As Boolean FoundBetter = False While Not FoundBetter And c <= CRT.Columns.Count If CRT(r, c) > CRT(r, 2) And CRT(r, c) < 1 Then FoundBetter = True Else c = c + 1 End If Wend existsBetter = FoundBetter If existsBetter Then r = r + 1 End If Wend findPurchase = CRT(r, 3) 'MsgBox(findPurchase) End Function I know the function does what it is supposed to because I have both manually checked the table of values, removed the comment ' from the MsgBox, and used the debug tools to step in and out of each of the functions steps as it went through the table. However, when I reference the function in Excel with =findPurchase() I'm given a #NAME? error. The function even shows up in the function auto-complete box when I begin to type its name. When I write other functions, both with and without parameters, I can reference them just fine, for example: Function addtwo() addtwo = 1 + 2 End Function What am I doing wrong with my function which causes it not to work? excel vba excel-vba share|improve this question asked Sep 16 '13 at 14:13 Teofrostus 3762413 Dim Found As Boolean Is it just because this line isn't dim'd correctly? –Joe Laviano Sep 16 '13
Forum Microsoft Office Application Help - Excel Help forum Excel Programming / VBA / Macros [SOLVED] Invalid name error when using function To get replies by our experts at nominal charges, follow this link to buy points and post
User Defined Function Excel Name Error
your thread in our Commercial Services forum! Here is the FAQ for this forum. excel custom function not recognized + Reply to Thread Results 1 to 11 of 11 Invalid name error when using function Thread Tools Show Printable Version Subscribe vba function not showing in excel to this Thread… Rate This Thread Current Rating Excellent Good Average Bad Terrible Display Linear Mode Switch to Hybrid Mode Switch to Threaded Mode 08-29-2013,10:40 AM #1 Davidwebb526 View Profile http://stackoverflow.com/questions/18830181/name-error-in-excel-for-vba-function View Forum Posts Registered User Join Date 08-29-2013 Location Sacramento MS-Off Ver Excel 2007 Posts 6 Invalid name error when using function So I total new at VBA. I'm using the Excel 2007 Bible to get started and the information is a bit overwhelming. This is probably a really stupid question to ask but here is my problem. I have been experimenting with functions. I created a functions using a Select Case http://www.excelforum.com/showthread.php?t=951211 Construct. The function worked perfectly when I typed it in. I saved/closed my workbook and took a break. I reopened my work book and tried the function again and I receieved an Invalid Name Error. Thoughts? Last edited by Davidwebb526; 08-29-2013 at 11:24 AM. Register To Reply 08-29-2013,10:44 AM #2 Solus Rankin View Profile View Forum Posts Forum Expert Join Date 05-24-2013 Location Hollywood, CA MS-Off Ver Win7 Office 2010 VS Express 2012 Posts 2,655 Re: Total Noob at VBA What is the name of your function? How are you calling it? Thanks, Solus Please remember the following: 1. Use [code] code tags [/code]. It keeps posts clean, easy-to-read, and maintains VBA formatting. Highlight the code in your post and press the # button in the toolbar.2. Show appreciation to those who have helped you by clicking below their posts. 3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top. "Slow is smooth, smooth is fast." Register To Reply 08-29-2013,10:46 AM #3 Davidwebb526 View Profile View Forum Posts Registered User Join Date 08-29-2013 Location Sacramento MS-Off Ver Excel 2007 Posts 6 Re: Total Noob at VBA I just called it "NumSign" and I'm calling it in the Fx field as "=NumSign()" Regist
Way | Trading Add-ins For Excel | Convert Excel Into Calculating Web Pages Excel Web Pages | Produce Clean Efficient VBA Code http://www.ozgrid.com/forum/showthread.php?t=39594 Every Time | Build Automated Trading Models In Excel | Excel Web Pages | Excel Video Training Forum New Posts FAQ Calendar Forum Actions Mark Forums Read Quick Links http://answers.microsoft.com/en-us/msoffice/forum/msoffice_excel-mso_mac/vba-cuberoot-function-gives-a-name-error/7691a919-6f09-427a-82ac-fb0dafe6706d Today's Posts What's New? Advanced Search Forum HELP FORUMS Excel General User Defined Function Causes #NAME! Error Excel Training / Excel Dashboards Reports If this is your first visit, name error be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. If you don't like Google AdSense in the posts, register or log in above. Click here vba function not to view the relaunched Ozgrid newsletter. Results 1 to 4 of 4 Thread: User Defined Function Causes #NAME! Error Thread Tools Show Printable Version Search Thread Advanced Search September 15th, 2005 #1 bassam13 View Profile View Forum Posts I agreed to these rules Join Date 15th September 2005 Posts 6 User Defined Function Causes #NAME! Error Excel is not recognizing my user defined function, I write a simple code like this: VB: Function CtoF(centigrade) CtoF = centigrade * 9 / 5 + 32 End Function The result I get is #NAME? What's the big thing that I am missing? Bassam Last edited by Jack in the UK; September 15th, 2005 at 17:22. Excel Video Tutorials / Excel Dashboards Reports Reply With Quote September 15th, 2005 #2 thomach View Profile View Forum Posts OzMVP Join Date 22nd April 2003 Location Virginia, USA Posts 5,035 Re: User Defined Function is not being accepted Hi, and Welcome to Ozgrid In answer to your question, I'm not sure. I just tried your UDF and it works fine for m
be down. Please try the request again. Your cache administrator is webmaster. Generated Sat, 15 Oct 2016 10:02:14 GMT by s_ac15 (squid/3.5.20)