Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 4th, 2004, 06:46 PM
Registered User
 
Join Date: Sep 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default User-Defined Functions - How to recalculate?

Hi everyone! This is my first posting.
I recently bought Excel 2003 VBA.
I'm brand new to VBA

I've written my own User-Defined Functions and they work great BUT
they only work once.

I have two worksheets.
Sheet A has a list of info.
Sheet B counts the number of rows depending on the info in the rows.

If a new row is added or changed in Sheet A, the UDF in Sheet B doesn't reflect the change UNLESS I go into the cell in Sheet B where the UDF is and click inside it and hit <RETURN> Then it reflects the changes in Sheet A.

How do I get the UDF in Sheet B to recalculate?

Thanks in advance!

K. Moran

K Moran
 
Old October 5th, 2004, 02:45 AM
Authorized User
 
Join Date: Aug 2004
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Normally UDFs only recalculate when linked cells change or if forced with the F9 key.

Make this the first line of your UDF to calculate whenever the sheet recalculates :-
Code:
Application.Volatile

-----------------------
Regards BrianB
Most problems occur from starting at the wrong place.
Use a cup of coffee to make Windows run faster.
It is easy until you know how.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Indexing tables in user defined functions A17560127 SQL Server 2005 1 July 21st, 2008 03:56 AM
User-defined functions fredh Excel VBA 1 May 7th, 2007 10:28 AM
Portability of User Defined Functions (UDFs) fredh Excel VBA 0 May 3rd, 2007 06:07 PM
Number format in User Defined Functions Moose35 Excel VBA 1 February 17th, 2005 05:23 AM
user defined functions in vba re_anu Access VBA 2 March 3rd, 2004 01:59 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.