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 July 1st, 2003, 01:40 PM
Registered User
 
Join Date: Jul 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default problems between sub and functions

I write custom functions that work well; I write macros that work well too; but when both are installed in the same VBA project(in separated modules), the execution becomes erratic: for ex. the focus jumps from one line in the middle of macro#1 to another line in a custom function......
What is wrong ? Should I provide a copy of the code, or is the problem at another level?
 
Old July 1st, 2003, 01:52 PM
Authorized User
 
Join Date: Jun 2003
Posts: 54
Thanks: 1
Thanked 0 Times in 0 Posts
Default

A macro is a public subroutine that doesn't have any parameters. You can't have a macro and a subroutine that have the same names in the same project.
 
Old July 11th, 2003, 01:21 PM
Registered User
 
Join Date: Jul 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

(The macros and functions have all different names).
I found that every personal function (using "Application.Volatile") present in some cell's formula is automacally recomputed after each change made by a macro in any cell.
So I solved my problem using the following code at the beginning of evry macro: Application.Calculation = xlCalculationManual
And at the end: Application.Calculation = xlCalculationAutomatic

Is that THE solution, or does a better practice exist?







Similar Threads
Thread Thread Starter Forum Replies Last Post
C# functions daniel.mihalcea C# 2008 aka C# 3.0 3 September 11th, 2008 05:10 PM
Functions czambran BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0 13 July 11th, 2006 06:33 PM
Functions Meg Intro Programming 1 January 23rd, 2006 01:03 PM
Problems with string functions and Access 2000 giggs Access VBA 5 February 25th, 2004 09:43 AM
Help! problems with functions and forms Toka1 Javascript How-To 6 December 16th, 2003 11:15 AM





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