Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default built-in function doesn't work properly

This simple Function doesn't update the result.... I have to edit the cell to
calculate new result. The easiest way i found is to prees 'F2' and 'Enter'
for each cell that have this function...

Thanks for any help


Function CupaoActual(RangeDatasCupao As Range) As Byte
Dim j As Byte

For j = 1 To RangeDatasCupao.Count
If RangeDatasCupao(1, j) Range("TodayDate") Then
CupaoActual = j - 1
Exit Function
End If
Next

End Function

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 126
Default built-in function doesn't work properly

You should pass as arguments *all* ranges you use in the function. In
your case, you are not passing the range named TodayDate.

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Multi-disciplinary business expertise
+ Technology skills
= Optimal solution to your business problem
Recipient Microsoft MVP award 2000-2005

In article ,
says...
This simple Function doesn't update the result.... I have to edit the cell to
calculate new result. The easiest way i found is to prees 'F2' and 'Enter'
for each cell that have this function...

Thanks for any help


Function CupaoActual(RangeDatasCupao As Range) As Byte
Dim j As Byte

For j = 1 To RangeDatasCupao.Count
If RangeDatasCupao(1, j) Range("TodayDate") Then
CupaoActual = j - 1
Exit Function
End If
Next

End Function


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 339
Default built-in function doesn't work properly


"Calaozao" wrote in message
...
This simple Function doesn't update the result.... I have to edit the cell

to
calculate new result. The easiest way i found is to prees 'F2' and 'Enter'
for each cell that have this function...

Thanks for any help


Function CupaoActual(RangeDatasCupao As Range) As Byte
Dim j As Byte

For j = 1 To RangeDatasCupao.Count
If RangeDatasCupao(1, j) Range("TodayDate") Then
CupaoActual = j - 1
Exit Function
End If
Next

End Function


There are two solutions

1) Pass the Range "TodayDate" to the UDF or use get it within the UDF. As it
is, the UDF is made in such a way that it prevents Excel from understanding
the it should recalculate all calls to CupaoActual when something within the
range does change. Maybe you should pass it as Date rather than range

2) After the declaration of j, insert Application.Volatile (True) This will
force Excel to always recalculate this function whether Excel thinks it
needs to or not.

The first solution is the better.

/Fredrik


Reply
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
Built-In Work Menu Option Pauline Setting up and Configuration of Excel 1 April 12th 08 12:26 AM
Why does this filter not work properly cj21 Excel Discussion (Misc queries) 6 March 29th 06 09:26 PM
function does not work properly lukiedukie Excel Worksheet Functions 3 April 22nd 05 10:23 PM
Can't get code to work properly. Please Help! sparky3883[_8_] Excel Programming 2 April 15th 04 01:55 PM
RefEdit doesn't work properly daMike Excel Programming 3 December 10th 03 01:43 PM


All times are GMT +1. The time now is 05:52 AM.

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

About Us

"It's about Microsoft Excel"