Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Excel / Programming / December 2007

Tip: Looking for answers? Try searching our database.

User Defined Function Opens Improperly - Round III

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
SteveM - 26 Nov 2007 03:35 GMT
(This a repost to bubble the query back to the top.  Still seeking a
solution.)

I wrote a couple of functions with data links to a second workbook.

The data workbook is already open when I open the workbook with the
functions.  However the cells containing the functions open up the
"####" error designator, not the function return value.  When I open
the function dialog box attached to a cell, I can see that it
calculates properly and the return value is correct.  And I can repair
the problem by simply closing the dialog box by clicking OK.

PLEASE NOTE THAT THIS IS NOT A PROBLEM WITH THE COLUMN WIDTH

If I widen the column the #### changes to this:

First the #Name? error designator appears for a moment then changes to
the #Value! designator.  Which I can repair by opening and closing the
associated dialog box for just one cell.  I can drag the repaired cell
down the column to repair the other cells with the same formula.

So it must be a lag linking up with the data source.  But if it is, I
don't know how to fix it.

Any ideas on how to prevent the fault from appearing at all?

Thanks Much,
Peter T - 26 Nov 2007 11:35 GMT
Select the cell with the UDF
In the Immediate window, ctrl-g, do
? activecell.value, activecell.value2

In your UDF, declare a temporary variable same as the function, if not
explicitly declared simply
dim vTmp as Variant

just above where you do 'myFunctionName = someResult'
vTmp = someResult
debug.print vTmp

Put a break on your UDF name, F9
Open your immediate window, Ctrl-g
Select a cell with your UDF and Enter
Code will break in the VBE, step through with F8
look for anything unexpected and the debug result

Regards,
Peter T

> (This a repost to bubble the query back to the top.  Still seeking a
> solution.)
[quoted text clipped - 23 lines]
>
> Thanks Much,
SteveM - 12 Dec 2007 18:51 GMT
Peter,

As an FYI, I just solved this problem.  Apparently Excel does not
recalculate User Defined functions with F9 or Application.Calculate.

It does work however with Application.CalculateFull.

Regards,

SteveM

> Select the cell with the UDF
> In the Immediate window, ctrl-g, do
[quoted text clipped - 44 lines]
>
> > Thanks Much,
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.