Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default VBA Functions accessing value from worksheet

Hi,

I have defined a function 'calculateIntrest' in a module in an excel
file. This function refers value in a different sheet say
'MasterDataSheet'. A Sheet say 'DataSheet' uses this fucntion to
calculate interest amount. Rate of interest is stored in
'MasterDataSheet' which is being referred by function
calculateIntrest(). Below is my problem.

I have Rate of Interest as 1.50 defined. Now considering this value, i
have entered data in 'DataSheet' and corrosponding calculations are
done using rate of interest as 1.50. Once my data entry is over i
change this Rate of interest from 1.50 to 2.0. Problem is EXCEL does
not recalculate the values in interest column unless i manually do F2
and enter. I understand as i am referring the value of
MasterDataSheet!RateOfInt from within my function calculateInterest it
is not updating automatically. But then how do update these values
automatically everytime RateOfInterest in MasterDataSheet is changed.

Any help will be greatly appreciated.

Sachin



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default VBA Functions accessing value from worksheet

You could make it volatile

in the first line of the function add
Application.Volatile

the better alternative is to make all ranges as arguments to your function.
Any change to a cell in the argument list would cause Excel to recalculate
the funciton.

--
Regards,
Tom Ogilvy

"sachinshah" wrote in message
...
Hi,

I have defined a function 'calculateIntrest' in a module in an excel
file. This function refers value in a different sheet say
'MasterDataSheet'. A Sheet say 'DataSheet' uses this fucntion to
calculate interest amount. Rate of interest is stored in
'MasterDataSheet' which is being referred by function
calculateIntrest(). Below is my problem.

I have Rate of Interest as 1.50 defined. Now considering this value, i
have entered data in 'DataSheet' and corrosponding calculations are
done using rate of interest as 1.50. Once my data entry is over i
change this Rate of interest from 1.50 to 2.0. Problem is EXCEL does
not recalculate the values in interest column unless i manually do F2
and enter. I understand as i am referring the value of
MasterDataSheet!RateOfInt from within my function calculateInterest it
is not updating automatically. But then how do update these values
automatically everytime RateOfInterest in MasterDataSheet is changed.

Any help will be greatly appreciated.

Sachin



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/



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
accessing excel 2003 functions with excel 2007 sheri Excel Worksheet Functions 2 December 27th 07 07:12 PM
Accessing cube functions (ie cubevalue) from VBA Jose B. Excel Worksheet Functions 0 September 27th 07 08:02 AM
error accessing a protected worksheet Erik Jahre Excel Worksheet Functions 0 February 24th 06 08:32 AM
Accessing Cells in Separate Worksheet mrjeffy321 Excel Discussion (Misc queries) 3 January 19th 06 11:58 PM
accessing CheckBox on Worksheet Mike Tomasura Excel Programming 4 July 24th 03 01:19 PM


All times are GMT +1. The time now is 03:57 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"