Out of context error in user defined function

Apologies to anyone who has already read this in Functions.  I realised after 
a few daysa of no response that I had posted in the wrong stream.

Excel 2007 query 

Error received in VBA window (Debug) = <Out of Context> 
Error on Spreadsheet = #VALUE# 

I have 'formatted' this function in much the same way as my twenty or more 
other functions in this spreadsheet, yet I end up with Out of Context. I 
have tried various approaches including an 'On Calculate' called sub-routine, 
but all to no avail. The code for the function is stored in Module1 of an 
xlam, which is where all my other working functions are also located. 

Please Help. 

Cut down summary of workbook 

Worksheet 1 (Name = "Inventory") 
Column C (3) – Alphabetic List of Titles, e.g. 
AIR AND WATER 
AIRCRAFT 
INSECTS 
ROBOTS 
SOUND 
SUPERSONIC JETS 
VIKINGS 
Column K (11) – Function built summary of holdings, examples of end values 
CG 
None Held 
CGIJ 
L 
G 
None Held 
C 

Worksheet 7 (Name = "None Held") 
Row 1 – column values separated by semi-colons for the purposes of this 
extracted summary - 
"Title";5;6;163;19 

Row 2 and subsequent 20 rows, call to function that is not working 

Call text is 
=Locate_None_Helds(B1+1,$D$1,ROW(),$E$1,SHEETNAME(1),SHEETNAME()) 
Text of Function = 

Function Locate_None_Helds(fFR As Long, fLR As Long, fCR As Long, fCNH As 
Long, _ 
fWSName1 As String, fWSName2 As String) As String 

Application.Volatile 

Locate_None_Helds = "" 

Dim tStatus As String 
Dim fTitle As String 


Dim I As Long 
Dim J As Long 
Dim K As Long 


K = fCNH + 1 
J = fCR 

If fCR > K Then 

Locate_None_Helds = "" 

Else 

For I = fFR To fLR 

tStatus = Worksheets(fWSName1).Cells(I, 11).Value 
fTitle = Worksheets(fWSName1).Cells(I, 3).Value 

If tStatus = "None Held" Then 
Worksheets(fWSName2).Cells(J, 2) = I 
Locate_None_Helds = fTitle 
Exit For 
End If 

Next I 

End If 

End Function 
Every time it gets to – Locate_None_Helds = fTitle 
the error <Out of Context> arises, and I just don't understand why. 

In my many other functions I use exactly the same idea of assigning a value 
to the name of the function, and that assigned value is what ends up in the 
calling cell, but on this occasion it won't work and I just don't understand 
why. 

Please help. 
With many thanks in anticipation 
Philip, Perth, Western Australia
0
Utf
3/10/2010 1:04:01 PM
excel.programming 6508 articles. 2 followers. Follow

0 Replies
1459 Views

Similar Articles

[PageSpeed] 17

Reply:

Similar Artilces:

Error Using NTBackup on Information Store
Could anyone point me in the direction to solve this error. Backup Status Operation: Backup Active backup destination: File Media name: "20060515.bkf created 5/15/2006 at 10:39 AM" Backup of "DELL-6450-4SK7B\Microsoft Information Store\First Storage Group" Backup set #1 on media #1 Backup description: "Set created 5/15/2006 at 10:39 AM" Media name: "20060515.bkf created 5/15/2006 at 10:39 AM" Backup Type: Normal Backup started on 5/15/2006 at 10:40 AM. Folder DELL-6450-4SK7B\Microsoft Information Store\First Storage Group\Mailbox Store (DELL-6450-4S...

Password Error
When setting up the email account outlook 2000 automaticaly checks the "remember password" box and the password box is blank. When I enter a password for each account,check the remember password box, and then hit apply, outlook send/recieve will work. When I close outlook I have to go through the whole process all over again because the program is not keeping the password(s). ...

Printing an item's user category value on POs
Does anyone know how to make a user category value for an inventory print on a PO? I've modified my PO form and added the Item Master table, then pulled in the User Category field and specified which of the 6 to use, but it still doesn't print. This same process worked to add these fields to sales documents. Thanks. -- Jim@TurboChef ...

consistency error
I ran dbcc checkdb on my company database and got the following message: CheckDb found 0 allocation errors and 1 consistency errors in database "Company Database". What should I do next? Also, I am preparing to upgrade from 9 SP2 to 10. I ran check file maintenance. CHECKDB found 0 allocation errors and 1 consistency errors in table 'GL00201' (object ID 2103118683). Can I proceed? "tstrop" wrote: > I ran dbcc checkdb on my company database and got the following message: > > CheckDb found 0 allocation errors and 1 consistency errors in database > ...

CSocket
hi! i am about to program a server/client app - i am already able to send and receive data either on the server side and on the client side. the only thing i am not able to do is to request and receive data within one function on the client side - for example i'd like to update user information on the client side by calling "UpdateUserData" which sends a request to the server and should receive the updated data. the client receives the requested data after finishing the function - which is too late for my intention... so i guess i need to implement the client socket in an extra...

Context Menus
Is it possible to show different context menus by right clicking on different areas of a picturebox f.e. ? An option is to build all the menus as subitems of the the main context menu and hide/unhide them with the visible method. Is there an other option on doing this? Thanks in advance, /\/ikos Am 25.03.2010 09:11, schrieb Nikos: > Is it possible to show different context menus by right clicking > on different areas of a picturebox f.e. ? > > An option is to build all the menus as subitems of the the main > context menu and hide/unhide them with the visible me...

HQ Billing Cycle Errors
I am running the Billing Cycle for Customer at HQ -- I have 500+ Customers but 35 are showing a Balance Error and cannot be closed. Basically Accounts receivable = 0 and Balance is greater in each case and I cannot see why. Does anyone have any ideas? Is there a query I can run to correct or even to check this? Appreciate any help ...

Strange error message in Outlook 2000
I have a user getting "Error while aging store "Mailbox - person name"" when they try to run the archive function of Outlook 2000. I've looked several places, but have found no solutions. Please help John Desselle ...

Analytical Accounting Error #3
Hi, I am getting the error 'This record has been created since your attempt to create. Changes will not be saved'. This I am getting while I am trying to add additional transaction dimension. Any idea? Ramesh ...

reported error (0x80070057)
When I try to send an email to several addresses using Outlook 2003, I get the error: Task 'xxx - Sending' reported error (0x80070057) : 'Could not complete the operation. One or more parameter values are not valid.' I see no apparent problem with the addresses. Please tell me in simple English (well, as simple as possible) how to solve this problem. I am not an expert user. Thank you. What type of mail account is this? Exchange, POP3, IMAP? "lemonscented" <lemonscented@discussions.microsoft.com> wrote in message news:EC994AB1-B72B-4...

Context menu
When I right click on a cell the context menu pops up, but all of the choices are grayed out. Any help is appreciated. All of them? If the sheet is protected, about half of them will be grayed out. HTH Otto "LJP" <anonymous@discussions.microsoft.com> wrote in message news:006e01c3a483$6cf76710$a301280a@phx.gbl... > When I right click on a cell the context menu pops up, > but all of the choices are grayed out. > Any help is appreciated. ...

User define message error!
Hi! I created a SDI app and I want to show a dialog after creating SDI, therefore I defined an user define message #define WMU_STARTUP (WM_APP+10) and call it from CSDIView::OnInitUpdate() with PostMessage(WM_STARTUP). In debug version it work correctly but in release version it generates an Application Error after close the program. what's the problem? Thankx ...

Syntax error and Script Error
Dear All, I am getting error whenver i open CRM on each page (Done, but with error on page). when i click on the yehllow icon: following message are listed. http://crmserver/_root/bar_top.aspx?...... http://crmserver/_root/left.aspx?...... http://crmserver/CS/home_cases.aspx?.... http://crmserver/_root/navbarpage.aspx?........ any help or advice will be much appriciated. Regards, Syed. I think there may be some problem with your JavaScript code written for the entities. ...

Errors with Verizon POP3
I am using WLM in Vista and am having problems with the Verizon email account. The following is an error report: Unable to send or receive messages for the Verizon (xxxxx) account. The connection to the server has failed. Server: 'incoming.verizon.net' Windows Live Mail Error ID: 0x800CCC0E Protocol: POP3 Port: 995 Secure(SSL): Yes Socket Error: 10060 The Outgoing port has been changed to 587. This has been occurring since yesterday. Last week a similar situation occurred with the AOL account. -- On Thu, 24 Dec 2009 11:47:29 -0500, Nissi1 wrote...

User tries to accept meeting request and gets this message:
"as the meeting organizer you do not have to respond to this meeting", which is in error - somone else is the meeting organizer. I can't find anything in the Product KB. Anyone know how to fix it? We are using Exch 2003 and Outlook client installs on XP. ...

Get Function & Class Name
Hi, Is there a way in VC++ to find the class Name and Function Name (of a class) where the process/Application is running/executing. Any help will be highly appreciated. Regards Sameer Sameer Motwani wrote: >Hi, >Is there a way in VC++ to find the class Name and Function Name (of a class) >where the process/Application is running/executing. > >Any help will be highly appreciated. I'm not quite sure what you're asking, but __FUNCTION__ is available in VC7 and later: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclang/html/_predir_predefined_mac...

No Current Record Error
When I run a microsoft scheduled task to run a macro daily to send an emailed report as a PDF I am receving the "No Current Record Error" in Access 2007. What is odd, is that the macro will run successfully if ran manually from Access but will not run with the scheduled task. Also, it is running successfully about 40% of the time, leading me to believe that there are certain changing data elements that are driving the error. Any information on this error is greatly appreciated. I can also "cancel" through the error message and the report will send out bu...

An unexpected error has occured while trying to download Windows Framework Library
Dear All, I've just acquired a Mac and am using the Mac compatible Microsoft Office package. After downloading it, the program keeps telling me that "An unexpected error has occured while trying to download Windows Framework Library". Does this mean anything that I should rectify? Is it going to cause me any trouble down the road? Thanks for helping guys! McIdiot On 1/30/07 7:02 AM, in article 1170169361.254402.73910@j27g2000cwj.googlegroups.com, "kaobeilah@yahoo.co.uk" <kaobeilah@yahoo.co.uk> wrote: > I've just acquired a Mac and am using the Mac c...

OMA/ActiveSync error
w2k server and exchange 2003 standard; OWA works great, finally got OMA to connect (iPAQ windows mobile 4.21.. using USB and ActiveSync 3.8 on PC) but am getting error code 0x80830003 when sync starts. No errors in event log for the server. KB 830563 refers to error code as a problem with ISA and rsasecurity, we don't have ISA installed. I have basic authentication enabled on the Active Sync folder in IIS default web site. Any ideas? ...

Exact function
I've created a simple spreadsheet. Column A is a list of 15,034 used Work Order reference numbers (many values are missing); Column C is a complete list (25,000 WO numbers). I want to get a separate list of unused numbers, but can't get the EXACT function to work. ( I believe it should place a TRUE value in column D when the numbers match.) I've used: =OR(EXACT(C1,$A$1:$A$15034)), which I replicated down column D. It gives me nothing but FALSE values, even though about half the numbers match. BTW, I do get a TRUE value if I use =EXACT(C21,A1), so it may be an array problem....

Outlook sending error
I seem to have a bad email stuck in the sending process. Each time I click "send/receive" I get the same error message. However the send of new messages to my stored Outlook contacts does succeed and they are received. My computer is a new Vaio with Win 7 and Outlook 2008, and outlook contacts transferred from an old computer with XP and outlook 2003. Everything worked for a month until I manually typed in an email address for a new email. The error occured whenI clicked send/receive. That message seems to be stuck there and creates a new error each time I send/...

GP10 - Picking Report
I would like to add the BoM user derined fields to the picking report - I was able to do this in GP8 by linking the Picklist File to the MOP_Pickdoc_Line but cannot seem to recreate in version 10. Any suggestions would be appreciated. M. After creating a new table relationship between the 2 tables it looks like all is good and I once again have access to the additional fields I wanted. M. "Maria" wrote: > > I would like to add the BoM user derined fields to the picking report - > > I was able to do this in GP8 by linking the Picklist File to the > MOP...

Microsoft CRM 4.0 Mobile
I've been reading all I can find on CRM's Mobile version, and I've seen no information since June, at which time CRM 4.0 Mobile was expected to be released "soon"... Well, "soon" has come and gone, and still no word on availability. Can somebody from Microsoft please supply a date so we can properly plan our CRM projects?? Thanks, Dave I would also like to have the answer about exact Date . I heard few days back from Microsoft that it will be released SOON. ------ Aamir Blog : http://mscrmsupport.wordpress.com/ Hi Dave, Microsoft released a Stateme...

order of context menu options
Is there a way to change the order of options in the right click context menu? I'm talking about the one that pops up when you right click an folder or a file in windows explorer. Here are the options I have: Explore Open Add to VCL media player's Playlist Search... Play with VCL Media player Add to Winamp's Bookmark list Enqueue in Winamp Play in Winamp Select Left Folder for Compare (this is for a terrific program called BeyondCompare) I want to organize these in an order that's more practical for me Explore Open Search... Select Left Folder for Comp...

.xls saving error
I am responsible for taking care of 4 computers at work. I have on computer that I am constantly getting the following error message whe I try to save a file. Each of the 4 computers use this same type o file but only this one computer errors. How can I fix the followin error.... "Your changes could not be saved to "xxxx".xls but were save to temporary document "yyyy". Close existing document, open th temporary document and svae it under a new name. Thanks Ric -- Message posted from http://www.ExcelForum.com When excel saves the file, it saves it as a temporary...