Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Custom Worksheet Function not updating

I have created a function that returns a range. The
function is called getRange(intColumn as Integer). I use
it in in a worksheet function as follows in cell A1:

=count(getRange(2))

It works when I type in the function, but when I make
changes on the worksheet, cell A1 is NOT updated
accordingly. It appears as if the cell is NOT re-
evaluating the getRange(2) when the worksheet is updated.
Any help would be appreciated. TIA...
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 860
Default Custom Worksheet Function not updating

Hi Hawki,

A UDF typically gets reevaluated only when its input parameters (in this
case, A1) or one of their precedents change. If you want to force a recalc
on every worksheet change, you can put Application.Volatile as the first
statement in your UDF.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


Hawki wrote:
I have created a function that returns a range. The
function is called getRange(intColumn as Integer). I use
it in in a worksheet function as follows in cell A1:

=count(getRange(2))

It works when I type in the function, but when I make
changes on the worksheet, cell A1 is NOT updated
accordingly. It appears as if the cell is NOT re-
evaluating the getRange(2) when the worksheet is updated.
Any help would be appreciated. TIA...


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Custom Worksheet Function not updating

Hi
one way:
use the column as range parameter in your function

or add the line
application.volatile at the beginning of your function

Note: As you don't use a cell/range reference in your function as
parameter Excel does not know if it should re-calculate the function if
something in column 2 changes.


--
Regards
Frank Kabel
Frankfurt, Germany


Hawki wrote:
I have created a function that returns a range. The
function is called getRange(intColumn as Integer). I use
it in in a worksheet function as follows in cell A1:

=count(getRange(2))

It works when I type in the function, but when I make
changes on the worksheet, cell A1 is NOT updated
accordingly. It appears as if the cell is NOT re-
evaluating the getRange(2) when the worksheet is updated.
Any help would be appreciated. TIA...


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
how to? custom worksheet function using VBA Fred Allen New Users to Excel 4 September 21st 08 12:48 PM
Custom Function not updating lister_d_000169 Excel Worksheet Functions 2 March 30th 06 10:03 AM
Custom Function not updating lister_d_000169 Excel Worksheet Functions 0 March 29th 06 08:38 PM
Need help with automating the updating of a function in worksheet [email protected] Excel Worksheet Functions 4 February 10th 06 03:33 PM
Worksheet Name as argument in Custom Function Larry D Excel Programming 1 September 25th 03 08:31 PM


All times are GMT +1. The time now is 12:16 AM.

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"