Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Auto invoke of a VBA Sub function

Suppose I have defined VBA Sub myFunct that picks up the contents of several
cells,
and processes these items to produce contents to be written to several other
cells,
IOW a function producing more than one value. How can I invoke this function
as part
of the normal worksheet execution cycle?

TIA

Ed


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 473
Default Auto invoke of a VBA Sub function

Jag Man wrote:
Suppose I have defined VBA Sub myFunct that picks up the contents of several
cells,
and processes these items to produce contents to be written to several other
cells,
IOW a function producing more than one value. How can I invoke this function
as part
of the normal worksheet execution cycle?


You could call your Sub procedure from the Worksheet_Calculate event (taking
care to avoid a recursive loop by using Application.EnableEvents = False).

But you would probably be better to remake it as a Function which takes the
input cells as arguments and returns the results as an array. Then
array-enter the function call into the output cells (using Ctrl+Shift+Enter).

Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - reply in newsgroup

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 38
Default Auto invoke of a VBA Sub function

Thnaks, Bill. I don't quite understand the last sentence. Do you mean one
would have to
do a keyboard action to distribute the array?

Ed


You could call your Sub procedure from the Worksheet_Calculate event

(taking
care to avoid a recursive loop by using Application.EnableEvents = False).

But you would probably be better to remake it as a Function which takes

the
input cells as arguments and returns the results as an array. Then
array-enter the function call into the output cells (using

Ctrl+Shift+Enter).

Bill Manville



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 473
Default Auto invoke of a VBA Sub function

Jag Man wrote:
Do you mean one would have to
do a keyboard action to distribute the array?


An array formula is entered from the keyboard into the selected cells
using Ctrl+Shift+Enter (instead of simply Enter).

(From VBA you set the FormulaArray property)

Bill Manville
MVP - Microsoft Excel, Oxford, England
No email replies please - reply in newsgroup

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
Excel invoke REST service function with Xpath fn parse result! Rand0m1y Excel Worksheet Functions 0 June 4th 09 03:43 PM
How do I invoke a call in Excel DeviceConnect Excel Discussion (Misc queries) 5 February 24th 09 09:34 PM
How can I invoke running a macro from within an "IF" function. ron Excel Worksheet Functions 11 February 8th 06 03:35 PM
VBA code to invoke the Print dialog box. lothario[_21_] Excel Programming 5 October 17th 03 02:19 AM
invoke macro from outside excel - auto macros nongo Excel Programming 2 October 7th 03 02:28 PM


All times are GMT +1. The time now is 06:24 PM.

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"