LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default User Defined Function used in Macro returns #VALUE

xl2k (I think) added an application.calculatefull.

Maybe you could use this:

Application.SendKeys "%^{F9}"

And if that didn't work, how about recording a macro when you:
Select the copied range
Edit|Replace
what: = (equal sign)
with: = (equal sign)
replace all.

And add that recorded code to your existing macro.

"hodler <" wrote:

So I wrote a function in excel 97 that works fine. when i select it and
copy it down the row, it works fine. But when I have a macro copy it,
the cells with my function return the #VALUE error. If i click in the
formula bar and press enter, it recalculates fine. I don't want to do
this 100 times, though and asking the macro to re calculate or pressing
the 'calculate now' button does not help.
This is the code for my function but, as I said, it works fine until a
macro tries to copy it.

Function FindEndOfDrawDown(Peak As Range, Valley As Range, Rng As
Range)
Dim myCell As Range
Dim Past As Boolean
Past = False
For Each myCell In Rng
If Past = True Then
If myCell.Value Peak.Value Then
FindEndOfDrawDown = myCell.Value
Exit Function
End If
Else
If myCell.Value = Valley.Value Then
Past = True
End If
End If
Next myCell
End Function

Please let me know if you have any idea what's going on. I have the
feeling it's excel 97 that's screwing up but i cant find any solution
on the microsoft support website.
thanks

Nick

---
Message posted from http://www.ExcelForum.com/


--

Dave Peterson

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
User defined function returns imprecise value when used in worksheet JohnM[_3_] Excel Discussion (Misc queries) 3 December 1st 09 12:52 PM
User Defined FUNCTION EAK Excel Discussion (Misc queries) 5 July 17th 08 07:07 PM
user defined function driller Excel Worksheet Functions 1 November 18th 06 04:51 PM
User-defined data type; Error: Only User-defined types... tiger_PRM Excel Programming 1 July 18th 04 03:32 PM
User-Defined Function pre-empting Built-in Function? How to undo???? MarWun Excel Programming 1 August 6th 03 09:31 PM


All times are GMT +1. The time now is 04:54 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"